1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
3
4---
5name: add_ptrtoint_p1_to_s64_lhs
6tracksRegLiveness: true
7body:             |
8  bb.0:
9    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
10
11    ; GCN-LABEL: name: add_ptrtoint_p1_to_s64_lhs
12    ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
13    ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
14    ; GCN: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
15    ; GCN: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
16    ; GCN: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[PTR_ADD]](p1)
17    ; GCN: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
18    %0:_(p1) = COPY $vgpr0_vgpr1
19    %1:_(s64) = COPY $vgpr2_vgpr3
20    %2:_(s64) = G_PTRTOINT %0
21    %3:_(s64) = G_ADD %2, %1
22    $vgpr0_vgpr1 = COPY %3
23
24...
25
26---
27name: add_ptrtoint_p1_to_s32_lhs
28tracksRegLiveness: true
29body:             |
30  bb.0:
31    liveins: $vgpr0_vgpr1, $vgpr2
32
33    ; GCN-LABEL: name: add_ptrtoint_p1_to_s32_lhs
34    ; GCN: liveins: $vgpr0_vgpr1, $vgpr2
35    ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
36    ; GCN: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
37    ; GCN: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[COPY]](p1)
38    ; GCN: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[PTRTOINT]], [[COPY1]]
39    ; GCN: $vgpr0 = COPY [[ADD]](s32)
40    %0:_(p1) = COPY $vgpr0_vgpr1
41    %1:_(s32) = COPY $vgpr2
42    %2:_(s32) = G_PTRTOINT %0
43    %3:_(s32) = G_ADD %2, %1
44    $vgpr0 = COPY %3
45
46...
47
48---
49name: add_ptrtoint_p3_to_s32_lhs
50tracksRegLiveness: true
51body:             |
52  bb.0:
53    liveins: $vgpr0, $vgpr1
54
55    ; GCN-LABEL: name: add_ptrtoint_p3_to_s32_lhs
56    ; GCN: liveins: $vgpr0, $vgpr1
57    ; GCN: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
58    ; GCN: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
59    ; GCN: [[PTR_ADD:%[0-9]+]]:_(p3) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
60    ; GCN: [[PTRTOINT:%[0-9]+]]:_(s32) = G_PTRTOINT [[PTR_ADD]](p3)
61    ; GCN: $vgpr0 = COPY [[PTRTOINT]](s32)
62    %0:_(p3) = COPY $vgpr0
63    %1:_(s32) = COPY $vgpr1
64    %2:_(s32) = G_PTRTOINT %0
65    %3:_(s32) = G_ADD %2, %1
66    $vgpr0 = COPY %3
67
68...
69
70---
71name: inttoptr_add_ptrtoint_p1_to_s64_lhs
72tracksRegLiveness: true
73body:             |
74  bb.0:
75    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
76
77    ; GCN-LABEL: name: inttoptr_add_ptrtoint_p1_to_s64_lhs
78    ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
79    ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
80    ; GCN: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
81    ; GCN: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
82    ; GCN: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p1)
83    %0:_(p1) = COPY $vgpr0_vgpr1
84    %1:_(s64) = COPY $vgpr2_vgpr3
85    %2:_(s64) = G_PTRTOINT %0
86    %3:_(s64) = G_ADD %2, %1
87    %4:_(p1) = G_INTTOPTR %3
88    $vgpr0_vgpr1 = COPY %4
89
90...
91
92---
93name: add_ptrtoint_v2p3_to_v2s32_lhs
94tracksRegLiveness: true
95body:             |
96  bb.0:
97    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
98
99    ; GCN-LABEL: name: add_ptrtoint_v2p3_to_v2s32_lhs
100    ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
101    ; GCN: [[COPY:%[0-9]+]]:_(<2 x p3>) = COPY $vgpr0_vgpr1
102    ; GCN: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3
103    ; GCN: [[PTR_ADD:%[0-9]+]]:_(<2 x p3>) = G_PTR_ADD [[COPY]], [[COPY1]](<2 x s32>)
104    ; GCN: [[PTRTOINT:%[0-9]+]]:_(<2 x s32>) = G_PTRTOINT [[PTR_ADD]](<2 x p3>)
105    ; GCN: $vgpr0_vgpr1 = COPY [[PTRTOINT]](<2 x s32>)
106    %0:_(<2 x p3>) = COPY $vgpr0_vgpr1
107    %1:_(<2 x s32>) = COPY $vgpr2_vgpr3
108    %2:_(<2 x s32>) = G_PTRTOINT %0
109    %3:_(<2 x s32>) = G_ADD %2, %1
110    $vgpr0_vgpr1 = COPY %3
111
112...
113
114---
115name: add_ptrtoint_v2p1_to_v2s32_lhs
116tracksRegLiveness: true
117body:             |
118  bb.0:
119    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
120
121    ; GCN-LABEL: name: add_ptrtoint_v2p1_to_v2s32_lhs
122    ; GCN: liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
123    ; GCN: [[COPY:%[0-9]+]]:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
124    ; GCN: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr4_vgpr5
125    ; GCN: [[PTRTOINT:%[0-9]+]]:_(<2 x s32>) = G_PTRTOINT [[COPY]](<2 x p1>)
126    ; GCN: [[ADD:%[0-9]+]]:_(<2 x s32>) = G_ADD [[PTRTOINT]], [[COPY1]]
127    ; GCN: $vgpr0_vgpr1 = COPY [[ADD]](<2 x s32>)
128    %0:_(<2 x p1>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
129    %1:_(<2 x s32>) = COPY $vgpr4_vgpr5
130    %2:_(<2 x s32>) = G_PTRTOINT %0
131    %3:_(<2 x s32>) = G_ADD %2, %1
132    $vgpr0_vgpr1 = COPY %3
133
134...
135
136---
137name: add_ptrtoint_p1_to_s64_rhs
138tracksRegLiveness: true
139body:             |
140  bb.0:
141    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
142
143    ; GCN-LABEL: name: add_ptrtoint_p1_to_s64_rhs
144    ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
145    ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
146    ; GCN: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
147    ; GCN: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
148    ; GCN: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[PTR_ADD]](p1)
149    ; GCN: $vgpr0_vgpr1 = COPY [[PTRTOINT]](s64)
150    %0:_(p1) = COPY $vgpr0_vgpr1
151    %1:_(s64) = COPY $vgpr2_vgpr3
152    %2:_(s64) = G_PTRTOINT %0
153    %3:_(s64) = G_ADD %1, %2
154    $vgpr0_vgpr1 = COPY %3
155
156...
157
158---
159name: add_ptrtoint_p1_to_s64_lhs_rhs
160tracksRegLiveness: true
161body:             |
162  bb.0:
163    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
164
165    ; GCN-LABEL: name: add_ptrtoint_p1_to_s64_lhs_rhs
166    ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
167    ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
168    ; GCN: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3
169    ; GCN: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY1]](p1)
170    ; GCN: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[PTRTOINT]](s64)
171    ; GCN: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[PTR_ADD]](p1)
172    ; GCN: $vgpr0_vgpr1 = COPY [[PTRTOINT1]](s64)
173    %0:_(p1) = COPY $vgpr0_vgpr1
174    %1:_(p1) = COPY $vgpr2_vgpr3
175    %2:_(s64) = G_PTRTOINT %0
176    %3:_(s64) = G_PTRTOINT %1
177    %4:_(s64) = G_ADD %2, %3
178    $vgpr0_vgpr1 = COPY %4
179
180...
181