1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=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: liveins: $vgpr0_vgpr1
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
14 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
15 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
16 %0:_(p0) = COPY $vgpr0_vgpr1
17 %1:_(s64) = G_PTRTOINT %0
18 $vgpr0_vgpr1 = COPY %1
22 name: test_ptrtoint_p1_to_s64
27 ; CHECK-LABEL: name: test_ptrtoint_p1_to_s64
28 ; CHECK: liveins: $vgpr0_vgpr1
30 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
31 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p1)
32 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
33 %0:_(p1) = COPY $vgpr0_vgpr1
34 %1:_(s64) = G_PTRTOINT %0
35 $vgpr0_vgpr1 = COPY %1
39 name: test_ptrtoint_p4_to_s64
44 ; CHECK-LABEL: name: test_ptrtoint_p4_to_s64
45 ; CHECK: liveins: $vgpr0_vgpr1
47 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
48 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p4)
49 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
50 %0:_(p4) = COPY $vgpr0_vgpr1
51 %1:_(s64) = G_PTRTOINT %0
52 $vgpr0_vgpr1 = COPY %1
56 name: test_ptrtoint_p3_to_s32
61 ; CHECK-LABEL: name: test_ptrtoint_p3_to_s32
62 ; CHECK: liveins: $vgpr0
64 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
65 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
66 ; CHECK-NEXT: $vgpr0 = COPY [[PTRTOINT]](s32)
67 %0:_(p3) = COPY $vgpr0
68 %1:_(s32) = G_PTRTOINT %0
73 name: test_ptrtoint_p5_to_s32
78 ; CHECK-LABEL: name: test_ptrtoint_p5_to_s32
79 ; CHECK: liveins: $vgpr0
81 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
82 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p5)
83 ; CHECK-NEXT: $vgpr0 = COPY [[PTRTOINT]](s32)
84 %0:_(p5) = COPY $vgpr0
85 %1:_(s32) = G_PTRTOINT %0
90 name: test_ptrtoint_p999_to_s64
95 ; CHECK-LABEL: name: test_ptrtoint_p999_to_s64
96 ; CHECK: liveins: $vgpr0_vgpr1
98 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
99 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p999)
100 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
101 %0:_(p999) = COPY $vgpr0_vgpr1
102 %1:_(s64) = G_PTRTOINT %0
103 $vgpr0_vgpr1 = COPY %1
107 name: test_ptrtoint_p0_to_s32
110 liveins: $vgpr0_vgpr1
112 ; CHECK-LABEL: name: test_ptrtoint_p0_to_s32
113 ; CHECK: liveins: $vgpr0_vgpr1
115 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
116 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
117 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT]](s64)
118 ; CHECK-NEXT: $vgpr0 = COPY [[TRUNC]](s32)
119 %0:_(p0) = COPY $vgpr0_vgpr1
120 %1:_(s32) = G_PTRTOINT %0
125 name: test_ptrtoint_p0_to_s128
128 liveins: $vgpr0_vgpr1
130 ; CHECK-LABEL: name: test_ptrtoint_p0_to_s128
131 ; CHECK: liveins: $vgpr0_vgpr1
133 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
134 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
135 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
136 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[PTRTOINT]](s64), [[C]](s64)
137 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[MV]](s128)
138 %0:_(p0) = COPY $vgpr0_vgpr1
139 %1:_(s128) = G_PTRTOINT %0
140 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
144 name: test_ptrtoint_v2p0_to_v2s64
147 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
149 ; CHECK-LABEL: name: test_ptrtoint_v2p0_to_v2s64
150 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
152 ; CHECK-NEXT: [[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: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV1]](p0)
156 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[PTRTOINT]](s64), [[PTRTOINT1]](s64)
157 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
158 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
159 %1:_(<2 x s64>) = G_PTRTOINT %0
160 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
164 name: test_ptrtoint_v2s32_to_v2p0
167 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
169 ; CHECK-LABEL: name: test_ptrtoint_v2s32_to_v2p0
170 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
172 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
173 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
174 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV]](p0)
175 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT]](s64)
176 ; CHECK-NEXT: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV1]](p0)
177 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT1]](s64)
178 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[TRUNC]](s32), [[TRUNC1]](s32)
179 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
180 %0:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
181 %1:_(<2 x s32>) = G_PTRTOINT %0
182 $vgpr0_vgpr1 = COPY %1
186 name: test_ptrtoint_p3_to_s29
191 ; CHECK-LABEL: name: test_ptrtoint_p3_to_s29
192 ; CHECK: liveins: $vgpr0
194 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
195 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
196 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s29) = G_TRUNC [[PTRTOINT]](s32)
197 ; CHECK-NEXT: S_ENDPGM 0, implicit [[TRUNC]](s29)
198 %0:_(p3) = COPY $vgpr0
199 %1:_(s29) = G_PTRTOINT %0
200 S_ENDPGM 0, implicit %1
204 name: test_ptrtoint_p3_to_s33
209 ; CHECK-LABEL: name: test_ptrtoint_p3_to_s33
210 ; CHECK: liveins: $vgpr0
212 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
213 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
214 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s33) = G_ZEXT [[PTRTOINT]](s32)
215 ; CHECK-NEXT: S_ENDPGM 0, implicit [[ZEXT]](s33)
216 %0:_(p3) = COPY $vgpr0
217 %1:_(s33) = G_PTRTOINT %0
218 S_ENDPGM 0, implicit %1