[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / test / CodeGen / AArch64 / GlobalISel / prelegalizercombiner-trivial-arith.mir
blob55e63ba01d35e88304a8a3f1d1568bd33fbe40bb
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
4 name:            right_ident_sub
5 tracksRegLiveness: true
6 body:             |
7   bb.1.entry:
8     liveins: $w0
9     ; Fold (x - 0) -> x
10     ;
11     ; CHECK-LABEL: name: right_ident_sub
12     ; CHECK: liveins: $w0
13     ; CHECK: %x:_(s32) = COPY $w0
14     ; CHECK: $w0 = COPY %x(s32)
15     ; CHECK: RET_ReallyLR implicit $w0
16     %x:_(s32) = COPY $w0
17     %cst:_(s32) = G_CONSTANT i32 0
18     %op:_(s32) = G_SUB %x(s32), %cst
19     $w0 = COPY %op(s32)
20     RET_ReallyLR implicit $w0
22 ...
23 ---
24 name:            right_ident_add
25 tracksRegLiveness: true
26 body:             |
27   bb.1.entry:
28     liveins: $w0
29     ; Fold (x + 0) -> x
30     ;
31     ; CHECK-LABEL: name: right_ident_add
32     ; CHECK: liveins: $w0
33     ; CHECK: %x:_(s32) = COPY $w0
34     ; CHECK: $w0 = COPY %x(s32)
35     ; CHECK: RET_ReallyLR implicit $w0
36     %x:_(s32) = COPY $w0
37     %cst:_(s32) = G_CONSTANT i32 0
38     %op:_(s32) = G_ADD %x(s32), %cst
39     $w0 = COPY %op(s32)
40     RET_ReallyLR implicit $w0
42 ...
43 ---
44 name:            mul_0
45 tracksRegLiveness: true
46 body:             |
47   bb.1.entry:
48     liveins: $w0
49     ; Fold (x * 0) -> 0
50     ;
51     ; CHECK-LABEL: name: mul_0
52     ; CHECK: liveins: $w0
53     ; CHECK: %cst:_(s32) = G_CONSTANT i32 0
54     ; CHECK: $w0 = COPY %cst(s32)
55     ; CHECK: RET_ReallyLR implicit $w0
56     %x:_(s32) = COPY $w0
57     %cst:_(s32) = G_CONSTANT i32 0
58     %op:_(s32) = G_MUL %x(s32), %cst
59     $w0 = COPY %op(s32)
60     RET_ReallyLR implicit $w0
62 ...
64 # FIXME: Probably should be able to replace this.
65 ---
66 name:            mul_0_cant_replace
67 tracksRegLiveness: true
68 body:             |
69   bb.1.entry:
70     liveins: $w0
71     ; Fold (x * 0) -> 0
72     ;
73     ; CHECK-LABEL: name: mul_0_cant_replace
74     ; CHECK: liveins: $w0
75     ; CHECK: %x:_(s32) = COPY $w0
76     ; CHECK: %cst:_(s32) = G_CONSTANT i32 0
77     ; CHECK: %op:gpr(s32) = G_MUL %x, %cst
78     ; CHECK: $w0 = COPY %op(s32)
79     ; CHECK: RET_ReallyLR implicit $w0
80     %x:_(s32) = COPY $w0
81     %cst:_(s32) = G_CONSTANT i32 0
82     %op:gpr(s32) = G_MUL %x(s32), %cst
83     $w0 = COPY %op(s32)
84     RET_ReallyLR implicit $w0
86 ...
88 ---
89 name:            sdiv_0
90 tracksRegLiveness: true
91 body:             |
92   bb.1.entry:
93     liveins: $w0
94     ; Fold (0 / x) -> 0
95     ;
96     ; CHECK-LABEL: name: sdiv_0
97     ; CHECK: liveins: $w0
98     ; CHECK: %cst:_(s32) = G_CONSTANT i32 0
99     ; CHECK: $w0 = COPY %cst(s32)
100     ; CHECK: RET_ReallyLR implicit $w0
101     %x:_(s32) = COPY $w0
102     %cst:_(s32) = G_CONSTANT i32 0
103     %op:_(s32) = G_SDIV %cst, %x
104     $w0 = COPY %op(s32)
105     RET_ReallyLR implicit $w0
109 name:            udiv_0
110 tracksRegLiveness: true
111 body:             |
112   bb.1.entry:
113     liveins: $w0
114     ; Fold (0 / x) -> 0
115     ;
116     ; CHECK-LABEL: name: udiv_0
117     ; CHECK: liveins: $w0
118     ; CHECK: %cst:_(s32) = G_CONSTANT i32 0
119     ; CHECK: $w0 = COPY %cst(s32)
120     ; CHECK: RET_ReallyLR implicit $w0
121     %x:_(s32) = COPY $w0
122     %cst:_(s32) = G_CONSTANT i32 0
123     %op:_(s32) = G_UDIV %cst, %x
124     $w0 = COPY %op(s32)
125     RET_ReallyLR implicit $w0
129 name:            srem_0
130 tracksRegLiveness: true
131 body:             |
132   bb.1.entry:
133     liveins: $w0
134     ; Fold (0 % x) -> 0
135     ;
136     ; CHECK-LABEL: name: srem_0
137     ; CHECK: liveins: $w0
138     ; CHECK: %cst:_(s32) = G_CONSTANT i32 0
139     ; CHECK: $w0 = COPY %cst(s32)
140     ; CHECK: RET_ReallyLR implicit $w0
141     %x:_(s32) = COPY $w0
142     %cst:_(s32) = G_CONSTANT i32 0
143     %op:_(s32) = G_SREM %cst, %x
144     $w0 = COPY %op(s32)
145     RET_ReallyLR implicit $w0
149 name:            urem_0
150 tracksRegLiveness: true
151 body:             |
152   bb.1.entry:
153     liveins: $w0
154     ; Fold (0 % x) -> 0
155     ;
156     ; CHECK-LABEL: name: urem_0
157     ; CHECK: liveins: $w0
158     ; CHECK: %cst:_(s32) = G_CONSTANT i32 0
159     ; CHECK: $w0 = COPY %cst(s32)
160     ; CHECK: RET_ReallyLR implicit $w0
161     %x:_(s32) = COPY $w0
162     %cst:_(s32) = G_CONSTANT i32 0
163     %op:_(s32) = G_UREM %cst, %x
164     $w0 = COPY %op(s32)
165     RET_ReallyLR implicit $w0
170 name:            right_ident_or
171 tracksRegLiveness: true
172 body:             |
173   bb.1.entry:
174     liveins: $w0
175     ; Fold (x || 0) -> x
176     ;
177     ; CHECK-LABEL: name: right_ident_or
178     ; CHECK: liveins: $w0
179     ; CHECK: %x:_(s32) = COPY $w0
180     ; CHECK: $w0 = COPY %x(s32)
181     ; CHECK: RET_ReallyLR implicit $w0
182     %x:_(s32) = COPY $w0
183     %cst:_(s32) = G_CONSTANT i32 0
184     %op:_(s32) = G_OR %x(s32), %cst
185     $w0 = COPY %op(s32)
186     RET_ReallyLR implicit $w0
190 name:            right_ident_xor
191 tracksRegLiveness: true
192 body:             |
193   bb.1.entry:
194     liveins: $w0
195     ; Fold (x | 0) -> x
196     ;
197     ; CHECK-LABEL: name: right_ident_xor
198     ; CHECK: liveins: $w0
199     ; CHECK: %x:_(s32) = COPY $w0
200     ; CHECK: $w0 = COPY %x(s32)
201     ; CHECK: RET_ReallyLR implicit $w0
202     %x:_(s32) = COPY $w0
203     %cst:_(s32) = G_CONSTANT i32 0
204     %op:_(s32) = G_XOR %x(s32), %cst
205     $w0 = COPY %op(s32)
206     RET_ReallyLR implicit $w0
210 name:            right_ident_shl
211 tracksRegLiveness: true
212 body:             |
213   bb.1.entry:
214     liveins: $w0
215     ; Fold (x << 0) -> x
216     ;
217     ; CHECK-LABEL: name: right_ident_shl
218     ; CHECK: liveins: $w0
219     ; CHECK: %x:_(s32) = COPY $w0
220     ; CHECK: $w0 = COPY %x(s32)
221     ; CHECK: RET_ReallyLR implicit $w0
222     %x:_(s32) = COPY $w0
223     %cst:_(s32) = G_CONSTANT i32 0
224     %op:_(s32) = G_SHL %x(s32), %cst
225     $w0 = COPY %op(s32)
226     RET_ReallyLR implicit $w0
230 name:            right_ident_ashr
231 tracksRegLiveness: true
232 body:             |
233   bb.1.entry:
234     liveins: $w0
235     ; Fold (x ashr 0) -> x
236     ;
237     ; CHECK-LABEL: name: right_ident_ashr
238     ; CHECK: liveins: $w0
239     ; CHECK: %x:_(s32) = COPY $w0
240     ; CHECK: $w0 = COPY %x(s32)
241     ; CHECK: RET_ReallyLR implicit $w0
242     %x:_(s32) = COPY $w0
243     %cst:_(s32) = G_CONSTANT i32 0
244     %op:_(s32) = G_ASHR %x(s32), %cst
245     $w0 = COPY %op(s32)
246     RET_ReallyLR implicit $w0
250 name:            right_ident_lshr
251 tracksRegLiveness: true
252 body:             |
253   bb.1.entry:
254     liveins: $w0
255     ; Fold (x lshr 0) -> x
256     ;
257     ; CHECK-LABEL: name: right_ident_lshr
258     ; CHECK: liveins: $w0
259     ; CHECK: %x:_(s32) = COPY $w0
260     ; CHECK: $w0 = COPY %x(s32)
261     ; CHECK: RET_ReallyLR implicit $w0
262     %x:_(s32) = COPY $w0
263     %cst:_(s32) = G_CONSTANT i32 0
264     %op:_(s32) = G_LSHR %x(s32), %cst
265     $w0 = COPY %op(s32)
266     RET_ReallyLR implicit $w0
270 name:            dont_fold_sub
271 tracksRegLiveness: true
272 body:             |
273   bb.1.entry:
274     liveins: $w0
275     ; Not an identity, no folding.
276     ;
277     ; CHECK-LABEL: name: dont_fold_sub
278     ; CHECK: liveins: $w0
279     ; CHECK: %x:_(s32) = COPY $w0
280     ; CHECK: %cst:_(s32) = G_CONSTANT i32 1
281     ; CHECK: %op:_(s32) = G_SUB %x, %cst
282     ; CHECK: $w0 = COPY %op(s32)
283     ; CHECK: RET_ReallyLR implicit $w0
284     %x:_(s32) = COPY $w0
285     %cst:_(s32) = G_CONSTANT i32 1
286     %op:_(s32) = G_SUB %x(s32), %cst
287     $w0 = COPY %op(s32)
288     RET_ReallyLR implicit $w0
292 name:            look_through_zext
293 tracksRegLiveness: true
294 body:             |
295   bb.0:
296     liveins: $x0
297     ; CHECK-LABEL: name: look_through_zext
298     ; CHECK: liveins: $x0
299     ; CHECK: %zero:_(s8) = G_CONSTANT i8 0
300     ; CHECK: %zext_zero:_(s64) = G_ZEXT %zero(s8)
301     ; CHECK: $x0 = COPY %zext_zero(s64)
302     ; CHECK: RET_ReallyLR implicit $x0
303     %zero:_(s8) = G_CONSTANT i8 0
304     %zext_zero:_(s64) = G_ZEXT %zero(s8)
305     %c:_(s64) = G_CONSTANT i64 72340172838076673
306     %mul:_(s64) = G_MUL %c, %zext_zero
307     $x0 = COPY %mul(s64)
308     RET_ReallyLR implicit $x0
311 name:            right_ident_ptr_add
312 tracksRegLiveness: true
313 body:             |
314   bb.1.entry:
315     liveins: $x0
316     ; Fold (x + 0) -> x
317     ;
318     ; CHECK-LABEL: name: right_ident_ptr_add
319     ; CHECK: liveins: $x0
320     ; CHECK: %x:_(p0) = COPY $x0
321     ; CHECK: $x0 = COPY %x(p0)
322     ; CHECK: RET_ReallyLR implicit $x0
323     %x:_(p0) = COPY $x0
324     %cst:_(s64) = G_CONSTANT i64 0
325     %op:_(p0) = G_PTR_ADD %x(p0), %cst
326     $x0 = COPY %op(p0)
327     RET_ReallyLR implicit $x0