1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -debugify-and-strip-all-safe -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombiner-only-enable-rule="match_addos" -global-isel -verify-machineinstrs %s -o - | FileCheck %s
5 # (G_*ADDO x, 0) -> x + no carry
10 tracksRegLiveness: true
14 ; CHECK-LABEL: name: uadd_zero
15 ; CHECK: liveins: $w0, $w1
17 ; CHECK-NEXT: %lhs:_(s32) = COPY $w0
18 ; CHECK-NEXT: %add:_(s32) = COPY %lhs(s32)
19 ; CHECK-NEXT: %o:_(s1) = G_CONSTANT i1 false
20 ; CHECK-NEXT: %o_wide:_(s32) = G_ZEXT %o(s1)
21 ; CHECK-NEXT: $w0 = COPY %add(s32)
22 ; CHECK-NEXT: $w1 = COPY %o_wide(s32)
23 ; CHECK-NEXT: RET_ReallyLR implicit $w0
24 %lhs:_(s32) = COPY $w0
25 %zero:_(s32) = G_CONSTANT i32 0
26 %add:_(s32), %o:_(s1) = G_UADDO %lhs, %zero
27 %o_wide:_(s32) = G_ZEXT %o(s1)
30 RET_ReallyLR implicit $w0
34 tracksRegLiveness: true
38 ; CHECK-LABEL: name: sadd_zero
39 ; CHECK: liveins: $w0, $w1
41 ; CHECK-NEXT: %lhs:_(s32) = COPY $w0
42 ; CHECK-NEXT: %add:_(s32) = COPY %lhs(s32)
43 ; CHECK-NEXT: %o:_(s1) = G_CONSTANT i1 false
44 ; CHECK-NEXT: %o_wide:_(s32) = G_ZEXT %o(s1)
45 ; CHECK-NEXT: $w0 = COPY %add(s32)
46 ; CHECK-NEXT: $w1 = COPY %o_wide(s32)
47 ; CHECK-NEXT: RET_ReallyLR implicit $w0
48 %lhs:_(s32) = COPY $w0
49 %zero:_(s32) = G_CONSTANT i32 0
50 %add:_(s32), %o:_(s1) = G_SADDO %lhs, %zero
51 %o_wide:_(s32) = G_ZEXT %o(s1)
54 RET_ReallyLR implicit $w0
58 tracksRegLiveness: true
62 ; CHECK-LABEL: name: wrong_cst
63 ; CHECK: liveins: $w0, $w1
65 ; CHECK-NEXT: %lhs:_(s32) = COPY $w0
66 ; CHECK-NEXT: %not_zero:_(s32) = G_CONSTANT i32 3
67 ; CHECK-NEXT: %add:_(s32), %o:_(s1) = G_UADDO %lhs, %not_zero
68 ; CHECK-NEXT: %o_wide:_(s32) = G_ZEXT %o(s1)
69 ; CHECK-NEXT: $w0 = COPY %add(s32)
70 ; CHECK-NEXT: $w1 = COPY %o_wide(s32)
71 ; CHECK-NEXT: RET_ReallyLR implicit $w0
72 %lhs:_(s32) = COPY $w0
73 %not_zero:_(s32) = G_CONSTANT i32 3
74 %add:_(s32), %o:_(s1) = G_UADDO %lhs, %not_zero
75 %o_wide:_(s32) = G_ZEXT %o(s1)
78 RET_ReallyLR implicit $w0
82 tracksRegLiveness: true
86 ; CHECK-LABEL: name: uadd_vec_zero
87 ; CHECK: liveins: $q0, $x0
89 ; CHECK-NEXT: %lhs:_(<2 x s64>) = COPY $q0
90 ; CHECK-NEXT: %zero:_(s64) = G_CONSTANT i64 0
91 ; CHECK-NEXT: %add:_(<2 x s64>) = COPY %lhs(<2 x s64>)
92 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
93 ; CHECK-NEXT: %o:_(<2 x s1>) = G_BUILD_VECTOR [[C]](s1), [[C]](s1)
94 ; CHECK-NEXT: %o_elt_0:_(s1) = G_EXTRACT_VECTOR_ELT %o(<2 x s1>), %zero(s64)
95 ; CHECK-NEXT: %o_wide:_(s64) = G_ZEXT %o_elt_0(s1)
96 ; CHECK-NEXT: $q0 = COPY %add(<2 x s64>)
97 ; CHECK-NEXT: $x0 = COPY %o_wide(s64)
98 ; CHECK-NEXT: RET_ReallyLR implicit $q0
99 %lhs:_(<2 x s64>) = COPY $q0
100 %zero:_(s64) = G_CONSTANT i64 0
101 %zero_vec:_(<2 x s64>) = G_BUILD_VECTOR %zero, %zero
102 %add:_(<2 x s64>), %o:_(<2 x s1>) = G_UADDO %lhs, %zero_vec
103 %o_elt_0:_(s1) = G_EXTRACT_VECTOR_ELT %o:_(<2 x s1>), %zero:_(s64)
104 %o_wide:_(s64) = G_ZEXT %o_elt_0
105 $q0 = COPY %add(<2 x s64>)
107 RET_ReallyLR implicit $q0
111 tracksRegLiveness: true
115 ; CHECK-LABEL: name: sadd_vec_zero
116 ; CHECK: liveins: $q0, $x0
118 ; CHECK-NEXT: %lhs:_(<2 x s64>) = COPY $q0
119 ; CHECK-NEXT: %zero:_(s64) = G_CONSTANT i64 0
120 ; CHECK-NEXT: %add:_(<2 x s64>) = COPY %lhs(<2 x s64>)
121 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
122 ; CHECK-NEXT: %o:_(<2 x s1>) = G_BUILD_VECTOR [[C]](s1), [[C]](s1)
123 ; CHECK-NEXT: %o_elt_0:_(s1) = G_EXTRACT_VECTOR_ELT %o(<2 x s1>), %zero(s64)
124 ; CHECK-NEXT: %o_wide:_(s64) = G_ZEXT %o_elt_0(s1)
125 ; CHECK-NEXT: $q0 = COPY %add(<2 x s64>)
126 ; CHECK-NEXT: $x0 = COPY %o_wide(s64)
127 ; CHECK-NEXT: RET_ReallyLR implicit $q0
128 %lhs:_(<2 x s64>) = COPY $q0
129 %zero:_(s64) = G_CONSTANT i64 0
130 %zero_vec:_(<2 x s64>) = G_BUILD_VECTOR %zero, %zero
131 %add:_(<2 x s64>), %o:_(<2 x s1>) = G_SADDO %lhs, %zero_vec
132 %o_elt_0:_(s1) = G_EXTRACT_VECTOR_ELT %o:_(<2 x s1>), %zero:_(s64)
133 %o_wide:_(s64) = G_ZEXT %o_elt_0
134 $q0 = COPY %add(<2 x s64>)
136 RET_ReallyLR implicit $q0