1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s
3
4---
5name: test_gep_global_i64_idx
6body: |
7  bb.0:
8    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
9
10    ; CHECK-LABEL: name: test_gep_global_i64_idx
11    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
12    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
13    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
14    ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p1)
15    %0:_(p1) = COPY $vgpr0_vgpr1
16    %1:_(s64) = COPY $vgpr2_vgpr3
17    %2:_(p1) = G_PTR_ADD %0, %1
18
19    $vgpr0_vgpr1 = COPY %2
20...
21
22---
23name: test_gep_flat_i64_idx
24body: |
25  bb.0:
26    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
27
28    ; CHECK-LABEL: name: test_gep_flat_i64_idx
29    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
30    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
31    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
32    ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p0)
33    %0:_(p0) = COPY $vgpr0_vgpr1
34    %1:_(s64) = COPY $vgpr2_vgpr3
35    %2:_(p0) = G_PTR_ADD %0, %1
36
37    $vgpr0_vgpr1 = COPY %2
38...
39
40---
41name: test_gep_constant_i64_idx
42body: |
43  bb.0:
44    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
45
46    ; CHECK-LABEL: name: test_gep_constant_i64_idx
47    ; CHECK: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1
48    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
49    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
50    ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p4)
51    %0:_(p4) = COPY $vgpr0_vgpr1
52    %1:_(s64) = COPY $vgpr2_vgpr3
53    %2:_(p4) = G_PTR_ADD %0, %1
54
55    $vgpr0_vgpr1 = COPY %2
56...
57
58---
59name: test_gep_local_i32_idx
60body: |
61  bb.0:
62    liveins: $vgpr0, $vgpr1
63
64    ; CHECK-LABEL: name: test_gep_local_i32_idx
65    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
66    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
67    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p3) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
68    ; CHECK: $vgpr0 = COPY [[PTR_ADD]](p3)
69    %0:_(p3) = COPY $vgpr0
70    %1:_(s32) = COPY $vgpr1
71    %2:_(p3) = G_PTR_ADD %0, %1
72
73    $vgpr0 = COPY %2
74...
75
76---
77name: test_gep_private_i32_idx
78body: |
79  bb.0:
80    liveins: $vgpr0, $vgpr1
81
82    ; CHECK-LABEL: name: test_gep_private_i32_idx
83    ; CHECK: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0
84    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
85    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p5) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
86    ; CHECK: $vgpr0 = COPY [[PTR_ADD]](p5)
87    %0:_(p5) = COPY $vgpr0
88    %1:_(s32) = COPY $vgpr1
89    %2:_(p5) = G_PTR_ADD %0, %1
90
91    $vgpr0 = COPY %2
92...
93
94---
95name: test_gep_constant32_i32_idx
96body: |
97  bb.0:
98    liveins: $sgpr0, $sgpr1
99
100    ; CHECK-LABEL: name: test_gep_constant32_i32_idx
101    ; CHECK: [[COPY:%[0-9]+]]:_(p6) = COPY $sgpr0
102    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $sgpr1
103    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p6) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
104    ; CHECK: $sgpr0 = COPY [[PTR_ADD]](p6)
105    %0:_(p6) = COPY $sgpr0
106    %1:_(s32) = COPY $sgpr1
107    %2:_(p6) = G_PTR_ADD %0, %1
108
109    $sgpr0 = COPY %2
110...
111
112---
113name: test_gep_region_i32_idx
114body: |
115  bb.0:
116    liveins: $vgpr0, $vgpr1
117
118    ; CHECK-LABEL: name: test_gep_region_i32_idx
119    ; CHECK: [[COPY:%[0-9]+]]:_(p2) = COPY $vgpr0
120    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
121    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p2) = G_PTR_ADD [[COPY]], [[COPY1]](s32)
122    ; CHECK: $vgpr0 = COPY [[PTR_ADD]](p2)
123    %0:_(p2) = COPY $vgpr0
124    %1:_(s32) = COPY $vgpr1
125    %2:_(p2) = G_PTR_ADD %0, %1
126
127    $vgpr0 = COPY %2
128...
129
130---
131name: test_gep_p999_i64_idx
132body: |
133  bb.0:
134    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
135
136    ; CHECK-LABEL: name: test_gep_p999_i64_idx
137    ; CHECK: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1
138    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
139    ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p999) = G_PTR_ADD [[COPY]], [[COPY1]](s64)
140    ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p999)
141    %0:_(p999) = COPY $vgpr0_vgpr1
142    %1:_(s64) = COPY $vgpr2_vgpr3
143    %2:_(p999) = G_PTR_ADD %0, %1
144    $vgpr0_vgpr1 = COPY %2
145...
146