1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-lowering -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=LOWER
3 # RUN: llc -mtriple aarch64 -O2 -start-before=aarch64-postlegalizer-lowering -stop-after=instruction-select -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=SELECT
8 tracksRegLiveness: true
12 ; LOWER-LABEL: name: same_reg
15 ; LOWER-NEXT: %r:_(s8) = G_IMPLICIT_DEF
16 ; LOWER-NEXT: %build_vector:_(<8 x s8>) = G_DUP %r(s8)
17 ; LOWER-NEXT: $d0 = COPY %build_vector(<8 x s8>)
18 ; LOWER-NEXT: RET_ReallyLR implicit $d0
20 ; SELECT-LABEL: name: same_reg
21 ; SELECT: liveins: $d0
23 ; SELECT-NEXT: %r:gpr32 = IMPLICIT_DEF
24 ; SELECT-NEXT: %build_vector:fpr64 = DUPv8i8gpr %r
25 ; SELECT-NEXT: $d0 = COPY %build_vector
26 ; SELECT-NEXT: RET_ReallyLR implicit $d0
27 %r:_(s8) = G_IMPLICIT_DEF
28 %build_vector:_(<8 x s8>) = G_BUILD_VECTOR %r, %r, %r, %r, %r, %r, %r, %r
29 $d0 = COPY %build_vector(<8 x s8>)
30 RET_ReallyLR implicit $d0
34 name: dont_combine_different_reg
36 tracksRegLiveness: true
39 liveins: $d0, $w0, $w1
40 ; LOWER-LABEL: name: dont_combine_different_reg
41 ; LOWER: liveins: $d0, $w0, $w1
43 ; LOWER-NEXT: %r:_(s32) = COPY $w0
44 ; LOWER-NEXT: %q:_(s32) = COPY $w1
45 ; LOWER-NEXT: %build_vector:_(<2 x s32>) = G_BUILD_VECTOR %r(s32), %q(s32)
46 ; LOWER-NEXT: $d0 = COPY %build_vector(<2 x s32>)
47 ; LOWER-NEXT: RET_ReallyLR implicit $d0
49 ; SELECT-LABEL: name: dont_combine_different_reg
50 ; SELECT: liveins: $d0, $w0, $w1
52 ; SELECT-NEXT: %r:gpr32all = COPY $w0
53 ; SELECT-NEXT: %q:gpr32 = COPY $w1
54 ; SELECT-NEXT: [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
55 ; SELECT-NEXT: [[INSERT_SUBREG:%[0-9]+]]:fpr128 = INSERT_SUBREG [[DEF]], %r, %subreg.ssub
56 ; SELECT-NEXT: [[INSvi32gpr:%[0-9]+]]:fpr128 = INSvi32gpr [[INSERT_SUBREG]], 1, %q
57 ; SELECT-NEXT: %build_vector:fpr64 = COPY [[INSvi32gpr]].dsub
58 ; SELECT-NEXT: $d0 = COPY %build_vector
59 ; SELECT-NEXT: RET_ReallyLR implicit $d0
62 %build_vector:_(<2 x s32>) = G_BUILD_VECTOR %r, %q
63 $d0 = COPY %build_vector(<2 x s32>)
64 RET_ReallyLR implicit $d0
68 name: dont_combine_zero
70 tracksRegLiveness: true
75 ; LOWER-LABEL: name: dont_combine_zero
78 ; LOWER-NEXT: %r:_(s8) = G_CONSTANT i8 0
79 ; LOWER-NEXT: %build_vector:_(<8 x s8>) = G_BUILD_VECTOR %r(s8), %r(s8), %r(s8), %r(s8), %r(s8), %r(s8), %r(s8), %r(s8)
80 ; LOWER-NEXT: $d0 = COPY %build_vector(<8 x s8>)
81 ; LOWER-NEXT: RET_ReallyLR implicit $d0
83 ; SELECT-LABEL: name: dont_combine_zero
84 ; SELECT: liveins: $d0
86 ; SELECT-NEXT: [[MOVIv2d_ns:%[0-9]+]]:fpr128 = MOVIv2d_ns 0
87 ; SELECT-NEXT: %build_vector:fpr64 = COPY [[MOVIv2d_ns]].dsub
88 ; SELECT-NEXT: $d0 = COPY %build_vector
89 ; SELECT-NEXT: RET_ReallyLR implicit $d0
90 %r:_(s8) = G_CONSTANT i8 0
91 %build_vector:_(<8 x s8>) = G_BUILD_VECTOR %r, %r, %r, %r, %r, %r, %r, %r
92 $d0 = COPY %build_vector(<8 x s8>)
93 RET_ReallyLR implicit $d0
97 name: dont_combine_all_ones
99 tracksRegLiveness: true
104 ; LOWER-LABEL: name: dont_combine_all_ones
105 ; LOWER: liveins: $d0
107 ; LOWER-NEXT: %r:_(s8) = G_CONSTANT i8 -1
108 ; LOWER-NEXT: %build_vector:_(<8 x s8>) = G_BUILD_VECTOR %r(s8), %r(s8), %r(s8), %r(s8), %r(s8), %r(s8), %r(s8), %r(s8)
109 ; LOWER-NEXT: $d0 = COPY %build_vector(<8 x s8>)
110 ; LOWER-NEXT: RET_ReallyLR implicit $d0
112 ; SELECT-LABEL: name: dont_combine_all_ones
113 ; SELECT: liveins: $d0
114 ; SELECT-NEXT: {{ $}}
115 ; SELECT-NEXT: %build_vector:fpr64 = MOVID 255
116 ; SELECT-NEXT: $d0 = COPY %build_vector
117 ; SELECT-NEXT: RET_ReallyLR implicit $d0
118 %r:_(s8) = G_CONSTANT i8 -1
119 %build_vector:_(<8 x s8>) = G_BUILD_VECTOR %r, %r, %r, %r, %r, %r, %r, %r
120 $d0 = COPY %build_vector(<8 x s8>)
121 RET_ReallyLR implicit $d0
125 name: all_zeros_pat_example
127 tracksRegLiveness: true
132 ; LOWER-LABEL: name: all_zeros_pat_example
133 ; LOWER: liveins: $d0
135 ; LOWER-NEXT: %v:_(<2 x s32>) = COPY $d0
136 ; LOWER-NEXT: %cst:_(s32) = G_CONSTANT i32 0
137 ; LOWER-NEXT: %build_vector:_(<2 x s32>) = G_BUILD_VECTOR %cst(s32), %cst(s32)
138 ; LOWER-NEXT: %sub:_(<2 x s32>) = G_SUB %build_vector, %v
139 ; LOWER-NEXT: $d0 = COPY %sub(<2 x s32>)
140 ; LOWER-NEXT: RET_ReallyLR implicit $d0
142 ; SELECT-LABEL: name: all_zeros_pat_example
143 ; SELECT: liveins: $d0
144 ; SELECT-NEXT: {{ $}}
145 ; SELECT-NEXT: %v:fpr64 = COPY $d0
146 ; SELECT-NEXT: %sub:fpr64 = NEGv2i32 %v
147 ; SELECT-NEXT: $d0 = COPY %sub
148 ; SELECT-NEXT: RET_ReallyLR implicit $d0
149 %v:_(<2 x s32>) = COPY $d0
150 %cst:_(s32) = G_CONSTANT i32 0
151 %build_vector:_(<2 x s32>) = G_BUILD_VECTOR %cst, %cst
152 %sub:_(<2 x s32>) = G_SUB %build_vector, %v
153 $d0 = COPY %sub(<2 x s32>)
154 RET_ReallyLR implicit $d0
158 name: all_ones_pat_example
160 tracksRegLiveness: true
165 ; LOWER-LABEL: name: all_ones_pat_example
166 ; LOWER: liveins: $d0, $d1
168 ; LOWER-NEXT: %v0:_(<2 x s32>) = COPY $d0
169 ; LOWER-NEXT: %v1:_(<2 x s32>) = COPY $d1
170 ; LOWER-NEXT: %cst:_(s32) = G_CONSTANT i32 -1
171 ; LOWER-NEXT: %build_vector:_(<2 x s32>) = G_BUILD_VECTOR %cst(s32), %cst(s32)
172 ; LOWER-NEXT: %xor:_(<2 x s32>) = G_XOR %v0, %build_vector
173 ; LOWER-NEXT: %and:_(<2 x s32>) = G_AND %v1, %xor
174 ; LOWER-NEXT: $d0 = COPY %and(<2 x s32>)
175 ; LOWER-NEXT: RET_ReallyLR implicit $d0
177 ; SELECT-LABEL: name: all_ones_pat_example
178 ; SELECT: liveins: $d0, $d1
179 ; SELECT-NEXT: {{ $}}
180 ; SELECT-NEXT: %v0:fpr64 = COPY $d0
181 ; SELECT-NEXT: %v1:fpr64 = COPY $d1
182 ; SELECT-NEXT: %and:fpr64 = BICv8i8 %v1, %v0
183 ; SELECT-NEXT: $d0 = COPY %and
184 ; SELECT-NEXT: RET_ReallyLR implicit $d0
185 %v0:_(<2 x s32>) = COPY $d0
186 %v1:_(<2 x s32>) = COPY $d1
187 %cst:_(s32) = G_CONSTANT i32 -1
188 %build_vector:_(<2 x s32>) = G_BUILD_VECTOR %cst, %cst
189 %xor:_(<2 x s32>) = G_XOR %v0, %build_vector
190 %and:_(<2 x s32>) = G_AND %v1, %xor
191 $d0 = COPY %and(<2 x s32>)
192 RET_ReallyLR implicit $d0