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
3
4---
5name: test_ptrtoint_p0_to_s64
6body: |
7  bb.0:
8    liveins: $vgpr0_vgpr1
9
10    ; CHECK-LABEL: name: test_ptrtoint_p0_to_s64
11    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
12    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
13    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
14    %0:_(p0) = COPY $vgpr0_vgpr1
15    %1:_(s64) = G_PTRTOINT %0
16    $vgpr0_vgpr1 = COPY %1
17...
18
19---
20name: test_ptrtoint_p1_to_s64
21body: |
22  bb.0:
23    liveins: $vgpr0_vgpr1
24
25    ; CHECK-LABEL: name: test_ptrtoint_p1_to_s64
26    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
27    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p1)
28    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
29    %0:_(p1) = COPY $vgpr0_vgpr1
30    %1:_(s64) = G_PTRTOINT %0
31    $vgpr0_vgpr1 = COPY %1
32...
33
34---
35name: test_ptrtoint_p4_to_s64
36body: |
37  bb.0:
38    liveins: $vgpr0_vgpr1
39
40    ; CHECK-LABEL: name: test_ptrtoint_p4_to_s64
41    ; CHECK: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
42    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p4)
43    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
44    %0:_(p4) = COPY $vgpr0_vgpr1
45    %1:_(s64) = G_PTRTOINT %0
46    $vgpr0_vgpr1 = COPY %1
47...
48
49---
50name: test_ptrtoint_p3_to_s32
51body: |
52  bb.0:
53    liveins: $vgpr0
54
55    ; CHECK-LABEL: name: test_ptrtoint_p3_to_s32
56    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
57    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
58    ; CHECK: $vgpr0 = COPY [[PTRTOINT]](s32)
59    %0:_(p3) = COPY $vgpr0
60    %1:_(s32) = G_PTRTOINT %0
61    $vgpr0 = COPY %1
62...
63
64---
65name: test_ptrtoint_p5_to_s32
66body: |
67  bb.0:
68    liveins: $vgpr0
69
70    ; CHECK-LABEL: name: test_ptrtoint_p5_to_s32
71    ; CHECK: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
72    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p5)
73    ; CHECK: $vgpr0 = COPY [[PTRTOINT]](s32)
74    %0:_(p5) = COPY $vgpr0
75    %1:_(s32) = G_PTRTOINT %0
76    $vgpr0 = COPY %1
77...
78
79---
80name: test_ptrtoint_p999_to_s64
81body: |
82  bb.0:
83    liveins: $vgpr0_vgpr1
84
85    ; CHECK-LABEL: name: test_ptrtoint_p999_to_s64
86    ; CHECK: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
87    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p999)
88    ; CHECK: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
89    %0:_(p999) = COPY $vgpr0_vgpr1
90    %1:_(s64) = G_PTRTOINT %0
91    $vgpr0_vgpr1 = COPY %1
92...
93
94---
95name: test_ptrtoint_p0_to_s32
96body: |
97  bb.0:
98    liveins: $vgpr0_vgpr1
99
100    ; CHECK-LABEL: name: test_ptrtoint_p0_to_s32
101    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
102    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
103    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT]](s64)
104    ; CHECK: $vgpr0 = COPY [[TRUNC]](s32)
105    %0:_(p0) = COPY $vgpr0_vgpr1
106    %1:_(s32) = G_PTRTOINT %0
107    $vgpr0 = COPY %1
108...
109
110---
111name: test_ptrtoint_p0_to_s128
112body: |
113  bb.0:
114    liveins: $vgpr0_vgpr1
115
116    ; CHECK-LABEL: name: test_ptrtoint_p0_to_s128
117    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
118    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
119    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
120    ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[PTRTOINT]](s64), [[C]](s64)
121    ; CHECK: $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
125...
126
127---
128name: test_ptrtoint_v2p0_to_v2s64
129body: |
130  bb.0:
131    liveins: $vgpr0_vgpr1_vgpr2_vgpr3
132
133    ; CHECK-LABEL: name: test_ptrtoint_v2p0_to_v2s64
134    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
135    ; CHECK: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
136    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV]](p0)
137    ; CHECK: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV1]](p0)
138    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[PTRTOINT]](s64), [[PTRTOINT1]](s64)
139    ; CHECK: $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
143...
144
145---
146name: test_ptrtoint_v2s32_to_v2p0
147body: |
148  bb.0:
149    liveins: $vgpr0_vgpr1_vgpr2_vgpr3
150
151    ; CHECK-LABEL: name: test_ptrtoint_v2s32_to_v2p0
152    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x p0>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
153    ; CHECK: [[UV:%[0-9]+]]:_(p0), [[UV1:%[0-9]+]]:_(p0) = G_UNMERGE_VALUES [[COPY]](<2 x p0>)
154    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV]](p0)
155    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT]](s64)
156    ; CHECK: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[UV1]](p0)
157    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[PTRTOINT1]](s64)
158    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[TRUNC]](s32), [[TRUNC1]](s32)
159    ; CHECK: $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
163...
164
165---
166name: test_ptrtoint_p3_to_s29
167body: |
168  bb.0:
169    liveins: $vgpr0
170
171    ; CHECK-LABEL: name: test_ptrtoint_p3_to_s29
172    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
173    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
174    ; CHECK: [[TRUNC:%[0-9]+]]:_(s29) = G_TRUNC [[PTRTOINT]](s32)
175    ; CHECK: S_ENDPGM 0, implicit [[TRUNC]](s29)
176    %0:_(p3) = COPY $vgpr0
177    %1:_(s29) = G_PTRTOINT %0
178    S_ENDPGM 0, implicit %1
179...
180
181---
182name: test_ptrtoint_p3_to_s33
183body: |
184  bb.0:
185    liveins: $vgpr0
186
187    ; CHECK-LABEL: name: test_ptrtoint_p3_to_s33
188    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
189    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p3)
190    ; CHECK: [[ZEXT:%[0-9]+]]:_(s33) = G_ZEXT [[PTRTOINT]](s32)
191    ; CHECK: S_ENDPGM 0, implicit [[ZEXT]](s33)
192    %0:_(p3) = COPY $vgpr0
193    %1:_(s33) = G_PTRTOINT %0
194    S_ENDPGM 0, implicit %1
195...
196