1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s
4 define i1 @t32_3_1(i32 %X) nounwind {
5 ; CHECK-LABEL: t32_3_1:
7 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
8 ; CHECK-NEXT: mov w9, #1431655765 // =0x55555555
9 ; CHECK-NEXT: movk w8, #43690, lsl #16
10 ; CHECK-NEXT: madd w8, w0, w8, w9
11 ; CHECK-NEXT: cmp w8, w9
12 ; CHECK-NEXT: cset w0, lo
14 %urem = urem i32 %X, 3
15 %cmp = icmp eq i32 %urem, 1
19 define i1 @t32_3_2(i32 %X) nounwind {
20 ; CHECK-LABEL: t32_3_2:
22 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
23 ; CHECK-NEXT: mov w9, #-1431655766 // =0xaaaaaaaa
24 ; CHECK-NEXT: movk w8, #43690, lsl #16
25 ; CHECK-NEXT: madd w8, w0, w8, w9
26 ; CHECK-NEXT: mov w9, #1431655765 // =0x55555555
27 ; CHECK-NEXT: cmp w8, w9
28 ; CHECK-NEXT: cset w0, lo
30 %urem = urem i32 %X, 3
31 %cmp = icmp eq i32 %urem, 2
36 define i1 @t32_5_1(i32 %X) nounwind {
37 ; CHECK-LABEL: t32_5_1:
39 ; CHECK-NEXT: mov w8, #52429 // =0xcccd
40 ; CHECK-NEXT: mov w9, #858993459 // =0x33333333
41 ; CHECK-NEXT: movk w8, #52428, lsl #16
42 ; CHECK-NEXT: madd w8, w0, w8, w9
43 ; CHECK-NEXT: cmp w8, w9
44 ; CHECK-NEXT: cset w0, lo
46 %urem = urem i32 %X, 5
47 %cmp = icmp eq i32 %urem, 1
51 define i1 @t32_5_2(i32 %X) nounwind {
52 ; CHECK-LABEL: t32_5_2:
54 ; CHECK-NEXT: mov w8, #52429 // =0xcccd
55 ; CHECK-NEXT: mov w9, #1717986918 // =0x66666666
56 ; CHECK-NEXT: movk w8, #52428, lsl #16
57 ; CHECK-NEXT: madd w8, w0, w8, w9
58 ; CHECK-NEXT: mov w9, #858993459 // =0x33333333
59 ; CHECK-NEXT: cmp w8, w9
60 ; CHECK-NEXT: cset w0, lo
62 %urem = urem i32 %X, 5
63 %cmp = icmp eq i32 %urem, 2
67 define i1 @t32_5_3(i32 %X) nounwind {
68 ; CHECK-LABEL: t32_5_3:
70 ; CHECK-NEXT: mov w8, #52429 // =0xcccd
71 ; CHECK-NEXT: mov w9, #-1717986919 // =0x99999999
72 ; CHECK-NEXT: movk w8, #52428, lsl #16
73 ; CHECK-NEXT: madd w8, w0, w8, w9
74 ; CHECK-NEXT: mov w9, #858993459 // =0x33333333
75 ; CHECK-NEXT: cmp w8, w9
76 ; CHECK-NEXT: cset w0, lo
78 %urem = urem i32 %X, 5
79 %cmp = icmp eq i32 %urem, 3
83 define i1 @t32_5_4(i32 %X) nounwind {
84 ; CHECK-LABEL: t32_5_4:
86 ; CHECK-NEXT: mov w8, #52429 // =0xcccd
87 ; CHECK-NEXT: mov w9, #-858993460 // =0xcccccccc
88 ; CHECK-NEXT: movk w8, #52428, lsl #16
89 ; CHECK-NEXT: madd w8, w0, w8, w9
90 ; CHECK-NEXT: mov w9, #858993459 // =0x33333333
91 ; CHECK-NEXT: cmp w8, w9
92 ; CHECK-NEXT: cset w0, lo
94 %urem = urem i32 %X, 5
95 %cmp = icmp eq i32 %urem, 4
100 define i1 @t32_6_1(i32 %X) nounwind {
101 ; CHECK-LABEL: t32_6_1:
103 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
104 ; CHECK-NEXT: mov w9, #1431655765 // =0x55555555
105 ; CHECK-NEXT: movk w8, #43690, lsl #16
106 ; CHECK-NEXT: madd w8, w0, w8, w9
107 ; CHECK-NEXT: mov w9, #43691 // =0xaaab
108 ; CHECK-NEXT: movk w9, #10922, lsl #16
109 ; CHECK-NEXT: ror w8, w8, #1
110 ; CHECK-NEXT: cmp w8, w9
111 ; CHECK-NEXT: cset w0, lo
113 %urem = urem i32 %X, 6
114 %cmp = icmp eq i32 %urem, 1
118 define i1 @t32_6_2(i32 %X) nounwind {
119 ; CHECK-LABEL: t32_6_2:
121 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
122 ; CHECK-NEXT: mov w9, #-1431655766 // =0xaaaaaaaa
123 ; CHECK-NEXT: movk w8, #43690, lsl #16
124 ; CHECK-NEXT: madd w8, w0, w8, w9
125 ; CHECK-NEXT: mov w9, #43691 // =0xaaab
126 ; CHECK-NEXT: movk w9, #10922, lsl #16
127 ; CHECK-NEXT: ror w8, w8, #1
128 ; CHECK-NEXT: cmp w8, w9
129 ; CHECK-NEXT: cset w0, lo
131 %urem = urem i32 %X, 6
132 %cmp = icmp eq i32 %urem, 2
136 define i1 @t32_6_3(i32 %X) nounwind {
137 ; CHECK-LABEL: t32_6_3:
139 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
140 ; CHECK-NEXT: mov w9, #-1 // =0xffffffff
141 ; CHECK-NEXT: movk w8, #43690, lsl #16
142 ; CHECK-NEXT: madd w8, w0, w8, w9
143 ; CHECK-NEXT: mov w9, #43691 // =0xaaab
144 ; CHECK-NEXT: movk w9, #10922, lsl #16
145 ; CHECK-NEXT: ror w8, w8, #1
146 ; CHECK-NEXT: cmp w8, w9
147 ; CHECK-NEXT: cset w0, lo
149 %urem = urem i32 %X, 6
150 %cmp = icmp eq i32 %urem, 3
154 define i1 @t32_6_4(i32 %X) nounwind {
155 ; CHECK-LABEL: t32_6_4:
157 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
158 ; CHECK-NEXT: sub w9, w0, #4
159 ; CHECK-NEXT: movk w8, #43690, lsl #16
160 ; CHECK-NEXT: mul w8, w9, w8
161 ; CHECK-NEXT: mov w9, #43690 // =0xaaaa
162 ; CHECK-NEXT: movk w9, #10922, lsl #16
163 ; CHECK-NEXT: ror w8, w8, #1
164 ; CHECK-NEXT: cmp w8, w9
165 ; CHECK-NEXT: cset w0, lo
167 %urem = urem i32 %X, 6
168 %cmp = icmp eq i32 %urem, 4
172 define i1 @t32_6_5(i32 %X) nounwind {
173 ; CHECK-LABEL: t32_6_5:
175 ; CHECK-NEXT: mov w8, #43691 // =0xaaab
176 ; CHECK-NEXT: sub w9, w0, #5
177 ; CHECK-NEXT: movk w8, #43690, lsl #16
178 ; CHECK-NEXT: mul w8, w9, w8
179 ; CHECK-NEXT: mov w9, #43690 // =0xaaaa
180 ; CHECK-NEXT: movk w9, #10922, lsl #16
181 ; CHECK-NEXT: ror w8, w8, #1
182 ; CHECK-NEXT: cmp w8, w9
183 ; CHECK-NEXT: cset w0, lo
185 %urem = urem i32 %X, 6
186 %cmp = icmp eq i32 %urem, 5
190 ;-------------------------------------------------------------------------------
193 define i1 @t16_3_2(i16 %X) nounwind {
194 ; CHECK-LABEL: t16_3_2:
196 ; CHECK-NEXT: mov w8, #-21845 // =0xffffaaab
197 ; CHECK-NEXT: mov w9, #-21846 // =0xffffaaaa
198 ; CHECK-NEXT: madd w8, w0, w8, w9
199 ; CHECK-NEXT: mov w9, #21845 // =0x5555
200 ; CHECK-NEXT: cmp w9, w8, uxth
201 ; CHECK-NEXT: cset w0, hi
203 %urem = urem i16 %X, 3
204 %cmp = icmp eq i16 %urem, 2
208 define i1 @t8_3_2(i8 %X) nounwind {
209 ; CHECK-LABEL: t8_3_2:
211 ; CHECK-NEXT: mov w8, #-85 // =0xffffffab
212 ; CHECK-NEXT: mov w9, #-86 // =0xffffffaa
213 ; CHECK-NEXT: madd w8, w0, w8, w9
214 ; CHECK-NEXT: and w8, w8, #0xff
215 ; CHECK-NEXT: cmp w8, #85
216 ; CHECK-NEXT: cset w0, lo
218 %urem = urem i8 %X, 3
219 %cmp = icmp eq i8 %urem, 2
223 define i1 @t64_3_2(i64 %X) nounwind {
224 ; CHECK-LABEL: t64_3_2:
226 ; CHECK-NEXT: mov x8, #-6148914691236517206 // =0xaaaaaaaaaaaaaaaa
227 ; CHECK-NEXT: mov x9, #-6148914691236517206 // =0xaaaaaaaaaaaaaaaa
228 ; CHECK-NEXT: movk x8, #43691
229 ; CHECK-NEXT: madd x8, x0, x8, x9
230 ; CHECK-NEXT: mov x9, #6148914691236517205 // =0x5555555555555555
231 ; CHECK-NEXT: cmp x8, x9
232 ; CHECK-NEXT: cset w0, lo
234 %urem = urem i64 %X, 3
235 %cmp = icmp eq i64 %urem, 2