1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - -mtriple=aarch64 -run-pass=aarch64-prelegalizer-combiner %s | FileCheck %s
4 name: test_combine_consecutive
9 ; CHECK-LABEL: name: test_combine_consecutive
10 ; CHECK: liveins: $w0, $w1
12 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
13 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
14 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32)
15 ; CHECK-NEXT: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
18 %2:_(<2 x s32>) = G_IMPLICIT_DEF
19 %7:_(s32) = G_CONSTANT i32 0
20 %8:_(s32) = G_CONSTANT i32 1
21 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
22 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %8(s32)
26 name: test_combine_diff_order
31 ; CHECK-LABEL: name: test_combine_diff_order
32 ; CHECK: liveins: $w0, $w1
34 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
35 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
36 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY1]](s32), [[COPY]](s32)
37 ; CHECK-NEXT: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
40 %2:_(<2 x s32>) = G_IMPLICIT_DEF
41 %7:_(s32) = G_CONSTANT i32 1
42 %8:_(s32) = G_CONSTANT i32 0
43 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
44 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %8(s32)
48 name: test_combine_insert_vec_build_vec_idx_1
51 liveins: $w0, $w1, $w2, $w3
53 ; CHECK-LABEL: name: test_combine_insert_vec_build_vec_idx_1
54 ; CHECK: liveins: $w0, $w1, $w2, $w3
56 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
57 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w2
58 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w3
59 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32)
60 ; CHECK-NEXT: $q0 = COPY [[BUILD_VECTOR]](<4 x s32>)
65 %2:_(<4 x s32>) = G_BUILD_VECTOR %0, %1, %6, %7
66 %3:_(s32) = G_CONSTANT i32 1
67 %4:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
71 name: test_combine_insert_vec_build_vec_idx_oob
74 liveins: $w0, $w1, $w2, $w3
76 ; CHECK-LABEL: name: test_combine_insert_vec_build_vec_idx_oob
77 ; CHECK: liveins: $w0, $w1, $w2, $w3
79 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<4 x s32>) = G_IMPLICIT_DEF
80 ; CHECK-NEXT: $q0 = COPY [[DEF]](<4 x s32>)
85 %2:_(<4 x s32>) = G_BUILD_VECTOR %0, %1, %6, %7
86 %3:_(s32) = G_CONSTANT i32 4
87 %4:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
91 name: test_combine_insert_vec_build_vec_variable
94 liveins: $w0, $w1, $w2, $w3
96 ; CHECK-LABEL: name: test_combine_insert_vec_build_vec_variable
97 ; CHECK: liveins: $w0, $w1, $w2, $w3
99 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
100 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
101 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
102 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
103 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32)
104 ; CHECK-NEXT: [[IVEC:%[0-9]+]]:_(<4 x s32>) = G_INSERT_VECTOR_ELT [[BUILD_VECTOR]], [[COPY]](s32), [[COPY]](s32)
105 ; CHECK-NEXT: $q0 = COPY [[IVEC]](<4 x s32>)
110 %2:_(<4 x s32>) = G_BUILD_VECTOR %0, %1, %6, %7
112 %4:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
116 name: test_combine_multiple_same_idx_1
121 ; CHECK-LABEL: name: test_combine_multiple_same_idx_1
122 ; CHECK: liveins: $w0, $w1
124 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
125 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
126 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32)
127 ; CHECK-NEXT: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
130 %2:_(<2 x s32>) = G_IMPLICIT_DEF
131 %7:_(s32) = G_CONSTANT i32 0
132 %8:_(s32) = G_CONSTANT i32 1
133 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
134 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %8(s32)
135 %5:_(<2 x s32>) = G_INSERT_VECTOR_ELT %4, %1(s32), %8(s32)
139 name: test_combine_multiple_same_idx_2
144 ; CHECK-LABEL: name: test_combine_multiple_same_idx_2
145 ; CHECK: liveins: $w0, $w1
147 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w1
148 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY]](s32)
149 ; CHECK-NEXT: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
152 %2:_(<2 x s32>) = G_IMPLICIT_DEF
153 %7:_(s32) = G_CONSTANT i32 0
154 %8:_(s32) = G_CONSTANT i32 1
155 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
156 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %7(s32)
157 %5:_(<2 x s32>) = G_INSERT_VECTOR_ELT %4, %1(s32), %8(s32)
161 name: test_combine_missing_idx
166 ; CHECK-LABEL: name: test_combine_missing_idx
167 ; CHECK: liveins: $w0, $w1
169 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
170 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
171 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
172 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[DEF]](s32), [[COPY1]](s32), [[COPY]](s32)
173 ; CHECK-NEXT: $q0 = COPY [[BUILD_VECTOR]](<4 x s32>)
176 %2:_(<4 x s32>) = G_IMPLICIT_DEF
177 %7:_(s32) = G_CONSTANT i32 0
178 %8:_(s32) = G_CONSTANT i32 2
179 %9:_(s32) = G_CONSTANT i32 3
180 %10:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
181 %11:_(<4 x s32>) = G_INSERT_VECTOR_ELT %10, %1(s32), %8(s32)
182 %12:_(<4 x s32>) = G_INSERT_VECTOR_ELT %11, %0(s32), %9(s32)
186 name: test_combine_negative_idx
190 ; CHECK-LABEL: name: test_combine_negative_idx
191 ; CHECK: liveins: $x0
193 ; CHECK-NEXT: RET_ReallyLR
194 %3:_(s8) = G_CONSTANT i8 127
195 %2:_(<32 x s8>) = G_BUILD_VECTOR %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8), %3(s8)
196 %4:_(s8) = G_CONSTANT i8 -128
197 %5:_(s64) = G_CONSTANT i64 -1
199 %1:_(<32 x s8>) = G_INSERT_VECTOR_ELT %2, %4(s8), %5(s64)
200 G_STORE %1(<32 x s8>), %0(p0) :: (store (<32 x s8>))