1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - -march=aarch64 -run-pass=aarch64-prelegalizer-combiner %s | FileCheck %s
4 name: test_combine_consecutive
9 ; CHECK-LABEL: name: test_combine_consecutive
10 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
11 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
12 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32)
13 ; CHECK: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
16 %2:_(<2 x s32>) = G_IMPLICIT_DEF
17 %7:_(s32) = G_CONSTANT i32 0
18 %8:_(s32) = G_CONSTANT i32 1
19 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
20 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %8(s32)
24 name: test_combine_diff_order
29 ; CHECK-LABEL: name: test_combine_diff_order
30 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
31 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
32 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY1]](s32), [[COPY]](s32)
33 ; CHECK: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
36 %2:_(<2 x s32>) = G_IMPLICIT_DEF
37 %7:_(s32) = G_CONSTANT i32 1
38 %8:_(s32) = G_CONSTANT i32 0
39 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
40 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %8(s32)
44 name: test_combine_insert_vec_build_vec_idx_1
47 liveins: $w0, $w1, $w2, $w3
49 ; CHECK-LABEL: name: test_combine_insert_vec_build_vec_idx_1
50 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
51 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w2
52 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w3
53 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32)
54 ; CHECK: $q0 = COPY [[BUILD_VECTOR]](<4 x s32>)
59 %2:_(<4 x s32>) = G_BUILD_VECTOR %0, %1, %6, %7
60 %3:_(s32) = G_CONSTANT i32 1
61 %4:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
65 name: test_combine_insert_vec_build_vec_idx_oob
68 liveins: $w0, $w1, $w2, $w3
70 ; CHECK-LABEL: name: test_combine_insert_vec_build_vec_idx_oob
71 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
72 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
73 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
74 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
75 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32)
76 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
77 ; CHECK: [[IVEC:%[0-9]+]]:_(<4 x s32>) = G_INSERT_VECTOR_ELT [[BUILD_VECTOR]], [[COPY]](s32), [[C]](s32)
78 ; CHECK: $q0 = COPY [[IVEC]](<4 x s32>)
83 %2:_(<4 x s32>) = G_BUILD_VECTOR %0, %1, %6, %7
84 %3:_(s32) = G_CONSTANT i32 4
85 %4:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
89 name: test_combine_insert_vec_build_vec_variable
92 liveins: $w0, $w1, $w2, $w3
94 ; CHECK-LABEL: name: test_combine_insert_vec_build_vec_variable
95 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
96 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
97 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
98 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $w3
99 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32), [[COPY2]](s32), [[COPY3]](s32)
100 ; CHECK: [[IVEC:%[0-9]+]]:_(<4 x s32>) = G_INSERT_VECTOR_ELT [[BUILD_VECTOR]], [[COPY]](s32), [[COPY]](s32)
101 ; CHECK: $q0 = COPY [[IVEC]](<4 x s32>)
106 %2:_(<4 x s32>) = G_BUILD_VECTOR %0, %1, %6, %7
108 %4:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %3(s32)
112 name: test_combine_multiple_same_idx_1
117 ; CHECK-LABEL: name: test_combine_multiple_same_idx_1
118 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
119 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
120 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32)
121 ; CHECK: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
124 %2:_(<2 x s32>) = G_IMPLICIT_DEF
125 %7:_(s32) = G_CONSTANT i32 0
126 %8:_(s32) = G_CONSTANT i32 1
127 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
128 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %8(s32)
129 %5:_(<2 x s32>) = G_INSERT_VECTOR_ELT %4, %1(s32), %8(s32)
133 name: test_combine_multiple_same_idx_2
138 ; CHECK-LABEL: name: test_combine_multiple_same_idx_2
139 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w1
140 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY]](s32)
141 ; CHECK: $x0 = COPY [[BUILD_VECTOR]](<2 x s32>)
144 %2:_(<2 x s32>) = G_IMPLICIT_DEF
145 %7:_(s32) = G_CONSTANT i32 0
146 %8:_(s32) = G_CONSTANT i32 1
147 %3:_(<2 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
148 %4:_(<2 x s32>) = G_INSERT_VECTOR_ELT %3, %1(s32), %7(s32)
149 %5:_(<2 x s32>) = G_INSERT_VECTOR_ELT %4, %1(s32), %8(s32)
153 name: test_combine_missing_idx
158 ; CHECK-LABEL: name: test_combine_missing_idx
159 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
160 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
161 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
162 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[DEF]](s32), [[COPY1]](s32), [[COPY]](s32)
163 ; CHECK: $q0 = COPY [[BUILD_VECTOR]](<4 x s32>)
166 %2:_(<4 x s32>) = G_IMPLICIT_DEF
167 %7:_(s32) = G_CONSTANT i32 0
168 %8:_(s32) = G_CONSTANT i32 2
169 %9:_(s32) = G_CONSTANT i32 3
170 %10:_(<4 x s32>) = G_INSERT_VECTOR_ELT %2, %0(s32), %7(s32)
171 %11:_(<4 x s32>) = G_INSERT_VECTOR_ELT %10, %1(s32), %8(s32)
172 %12:_(<4 x s32>) = G_INSERT_VECTOR_ELT %11, %0(s32), %9(s32)