1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -O0 -run-pass=legalizer -global-isel-abort=0 -o - %s | FileCheck %s
5 name: test_ptrtoint_p0_to_s64
10 ; CHECK-LABEL: name: test_ptrtoint_p0_to_s64
11 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
12 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
13 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
14 %0:_(p0) = COPY $vgpr0_vgpr1
15 %1:_(s64) = G_PTRTOINT %0
16 $vgpr0_vgpr1 = COPY %1
20 name: test_ptrtoint_p1_to_s64
25 ; CHECK-LABEL: name: test_ptrtoint_p1_to_s64
26 ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
27 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p1)
28 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
29 %0:_(p1) = COPY $vgpr0_vgpr1
30 %1:_(s64) = G_PTRTOINT %0
31 $vgpr0_vgpr1 = COPY %1
35 name: test_ptrtoint_p4_to_s64
40 ; CHECK-LABEL: name: test_ptrtoint_p4_to_s64
41 ; CHECK: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
42 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p4)
43 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
44 %0:_(p4) = COPY $vgpr0_vgpr1
45 %1:_(s64) = G_PTRTOINT %0
46 $vgpr0_vgpr1 = COPY %1
50 name: test_ptrtoint_p3_to_s32
55 ; CHECK-LABEL: name: test_ptrtoint_p3_to_s32
56 ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
57 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
58 ; CHECK-NEXT: $vgpr0 = COPY [[PTRTOINT]](s32)
59 %0:_(p3) = COPY $vgpr0
60 %1:_(s32) = G_PTRTOINT %0
65 name: test_ptrtoint_p5_to_s32
70 ; CHECK-LABEL: name: test_ptrtoint_p5_to_s32
71 ; CHECK: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
72 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p5)
73 ; CHECK-NEXT: $vgpr0 = COPY [[PTRTOINT]](s32)
74 %0:_(p5) = COPY $vgpr0
75 %1:_(s32) = G_PTRTOINT %0
80 name: test_ptrtoint_p999_to_s64
85 ; CHECK-LABEL: name: test_ptrtoint_p999_to_s64
86 ; CHECK: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
87 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p999)
88 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
89 %0:_(p999) = COPY $vgpr0_vgpr1
90 %1:_(s64) = G_PTRTOINT %0
91 $vgpr0_vgpr1 = COPY %1
95 name: test_ptrtoint_p0_to_s32
100 ; CHECK-LABEL: name: test_ptrtoint_p0_to_s32
101 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
102 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
103 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT]](s64)
104 ; CHECK-NEXT: $vgpr0 = COPY [[TRUNC]](s32)
105 %0:_(p0) = COPY $vgpr0_vgpr1
106 %1:_(s32) = G_PTRTOINT %0
111 name: test_ptrtoint_p0_to_s128
114 liveins: $vgpr0_vgpr1
116 ; CHECK-LABEL: name: test_ptrtoint_p0_to_s128
117 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
118 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
119 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
120 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[PTRTOINT]](s64), [[C]](s64)
121 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[MV]](s128)
122 %0:_(p0) = COPY $vgpr0_vgpr1
123 %1:_(s128) = G_PTRTOINT %0
124 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
128 name: test_ptrtoint_v2p0_to_v2s64
131 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
133 ; CHECK-LABEL: name: test_ptrtoint_v2p0_to_v2s64
134 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
135 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
136 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV]](p0)
137 ; CHECK-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV1]](p0)
138 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[PTRTOINT]](s64), [[PTRTOINT1]](s64)
139 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
140 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
141 %1:_(<2 x s64>) = G_PTRTOINT %0
142 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
146 name: test_ptrtoint_v2s32_to_v2p0
149 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
151 ; CHECK-LABEL: name: test_ptrtoint_v2s32_to_v2p0
152 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
153 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
154 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV]](p0)
155 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT]](s64)
156 ; CHECK-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV1]](p0)
157 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT1]](s64)
158 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[TRUNC]](s32), [[TRUNC1]](s32)
159 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
160 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
161 %1:_(<2 x s32>) = G_PTRTOINT %0
162 $vgpr0_vgpr1 = COPY %1
166 name: test_ptrtoint_p3_to_s29
171 ; CHECK-LABEL: name: test_ptrtoint_p3_to_s29
172 ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
173 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
174 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s29) = G_TRUNC [[PTRTOINT]](s32)
175 ; CHECK-NEXT: S_ENDPGM 0, implicit [[TRUNC]](s29)
176 %0:_(p3) = COPY $vgpr0
177 %1:_(s29) = G_PTRTOINT %0
178 S_ENDPGM 0, implicit %1
182 name: test_ptrtoint_p3_to_s33
187 ; CHECK-LABEL: name: test_ptrtoint_p3_to_s33
188 ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
189 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
190 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s33) = G_ZEXT [[PTRTOINT]](s32)
191 ; CHECK-NEXT: S_ENDPGM 0, implicit [[ZEXT]](s33)
192 %0:_(p3) = COPY $vgpr0
193 %1:_(s33) = G_PTRTOINT %0
194 S_ENDPGM 0, implicit %1