1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumb-eabi < %s | FileCheck %s
4 define i1 @test_urem_odd(i13 %X) nounwind {
5 ; CHECK-LABEL: test_urem_odd:
7 ; CHECK-NEXT: ldr r1, .LCPI0_0
8 ; CHECK-NEXT: muls r1, r0, r1
9 ; CHECK-NEXT: ldr r0, .LCPI0_1
10 ; CHECK-NEXT: cmp r1, r0
11 ; CHECK-NEXT: blo .LBB0_2
12 ; CHECK-NEXT: @ %bb.1:
13 ; CHECK-NEXT: movs r0, #0
15 ; CHECK-NEXT: .LBB0_2:
16 ; CHECK-NEXT: movs r0, #1
18 ; CHECK-NEXT: .p2align 2
19 ; CHECK-NEXT: @ %bb.3:
20 ; CHECK-NEXT: .LCPI0_0:
21 ; CHECK-NEXT: .long 1718091776 @ 0x66680000
22 ; CHECK-NEXT: .LCPI0_1:
23 ; CHECK-NEXT: .long 859308032 @ 0x33380000
24 %urem = urem i13 %X, 5
25 %cmp = icmp eq i13 %urem, 0
29 define i1 @test_urem_even(i27 %X) nounwind {
30 ; CHECK-LABEL: test_urem_even:
32 ; CHECK-NEXT: ldr r1, .LCPI1_0
33 ; CHECK-NEXT: muls r1, r0, r1
34 ; CHECK-NEXT: lsls r0, r1, #31
35 ; CHECK-NEXT: ldr r2, .LCPI1_1
36 ; CHECK-NEXT: ands r2, r1
37 ; CHECK-NEXT: lsrs r1, r2, #1
38 ; CHECK-NEXT: lsls r1, r1, #5
39 ; CHECK-NEXT: adds r0, r0, r1
40 ; CHECK-NEXT: ldr r1, .LCPI1_2
41 ; CHECK-NEXT: cmp r0, r1
42 ; CHECK-NEXT: blo .LBB1_2
43 ; CHECK-NEXT: @ %bb.1:
44 ; CHECK-NEXT: movs r0, #0
46 ; CHECK-NEXT: .LBB1_2:
47 ; CHECK-NEXT: movs r0, #1
49 ; CHECK-NEXT: .p2align 2
50 ; CHECK-NEXT: @ %bb.3:
51 ; CHECK-NEXT: .LCPI1_0:
52 ; CHECK-NEXT: .long 115043767 @ 0x6db6db7
53 ; CHECK-NEXT: .LCPI1_1:
54 ; CHECK-NEXT: .long 134217726 @ 0x7fffffe
55 ; CHECK-NEXT: .LCPI1_2:
56 ; CHECK-NEXT: .long 306783392 @ 0x124924a0
57 %urem = urem i27 %X, 14
58 %cmp = icmp eq i27 %urem, 0
62 define i1 @test_urem_odd_setne(i4 %X) nounwind {
63 ; CHECK-LABEL: test_urem_odd_setne:
65 ; CHECK-NEXT: movs r1, #13
66 ; CHECK-NEXT: muls r1, r0, r1
67 ; CHECK-NEXT: movs r0, #15
68 ; CHECK-NEXT: ands r0, r1
69 ; CHECK-NEXT: cmp r0, #3
70 ; CHECK-NEXT: bhi .LBB2_2
71 ; CHECK-NEXT: @ %bb.1:
72 ; CHECK-NEXT: movs r0, #0
74 ; CHECK-NEXT: .LBB2_2:
75 ; CHECK-NEXT: movs r0, #1
78 %cmp = icmp ne i4 %urem, 0
82 define i1 @test_urem_negative_odd(i9 %X) nounwind {
83 ; CHECK-LABEL: test_urem_negative_odd:
85 ; CHECK-NEXT: movs r1, #255
86 ; CHECK-NEXT: adds r1, #52
87 ; CHECK-NEXT: muls r1, r0, r1
88 ; CHECK-NEXT: ldr r0, .LCPI3_0
89 ; CHECK-NEXT: ands r0, r1
90 ; CHECK-NEXT: cmp r0, #1
91 ; CHECK-NEXT: bhi .LBB3_2
92 ; CHECK-NEXT: @ %bb.1:
93 ; CHECK-NEXT: movs r0, #0
95 ; CHECK-NEXT: .LBB3_2:
96 ; CHECK-NEXT: movs r0, #1
98 ; CHECK-NEXT: .p2align 2
99 ; CHECK-NEXT: @ %bb.3:
100 ; CHECK-NEXT: .LCPI3_0:
101 ; CHECK-NEXT: .long 511 @ 0x1ff
102 %urem = urem i9 %X, -5
103 %cmp = icmp ne i9 %urem, 0
107 define <3 x i1> @test_urem_vec(<3 x i11> %X) nounwind {
108 ; CHECK-LABEL: test_urem_vec:
110 ; CHECK-NEXT: .save {r4, r5, r7, lr}
111 ; CHECK-NEXT: push {r4, r5, r7, lr}
112 ; CHECK-NEXT: ldr r3, .LCPI4_0
113 ; CHECK-NEXT: muls r3, r0, r3
114 ; CHECK-NEXT: lsls r0, r3, #10
115 ; CHECK-NEXT: ldr r4, .LCPI4_1
116 ; CHECK-NEXT: ands r4, r3
117 ; CHECK-NEXT: lsrs r3, r4, #1
118 ; CHECK-NEXT: adds r0, r3, r0
119 ; CHECK-NEXT: ldr r3, .LCPI4_2
120 ; CHECK-NEXT: ands r3, r0
121 ; CHECK-NEXT: lsrs r0, r3, #1
122 ; CHECK-NEXT: movs r3, #1
123 ; CHECK-NEXT: movs r4, #0
124 ; CHECK-NEXT: cmp r0, #170
125 ; CHECK-NEXT: mov r12, r3
126 ; CHECK-NEXT: mov r0, r12
127 ; CHECK-NEXT: bhi .LBB4_2
128 ; CHECK-NEXT: @ %bb.1:
129 ; CHECK-NEXT: movs r0, r4
130 ; CHECK-NEXT: .LBB4_2:
131 ; CHECK-NEXT: subs r1, r1, #1
132 ; CHECK-NEXT: ldr r5, .LCPI4_3
133 ; CHECK-NEXT: muls r5, r1, r5
134 ; CHECK-NEXT: movs r1, #73
135 ; CHECK-NEXT: lsls r1, r1, #23
136 ; CHECK-NEXT: cmp r5, r1
137 ; CHECK-NEXT: mov r12, r3
138 ; CHECK-NEXT: mov r1, r12
139 ; CHECK-NEXT: bhi .LBB4_4
140 ; CHECK-NEXT: @ %bb.3:
141 ; CHECK-NEXT: movs r1, r4
142 ; CHECK-NEXT: .LBB4_4:
143 ; CHECK-NEXT: subs r2, r2, #2
144 ; CHECK-NEXT: ldr r5, .LCPI4_4
145 ; CHECK-NEXT: muls r5, r2, r5
146 ; CHECK-NEXT: ldr r2, .LCPI4_5
147 ; CHECK-NEXT: ands r2, r5
148 ; CHECK-NEXT: cmp r2, #1
149 ; CHECK-NEXT: bhi .LBB4_6
150 ; CHECK-NEXT: @ %bb.5:
151 ; CHECK-NEXT: movs r3, r4
152 ; CHECK-NEXT: .LBB4_6:
153 ; CHECK-NEXT: movs r2, r3
154 ; CHECK-NEXT: pop {r4, r5, r7}
155 ; CHECK-NEXT: pop {r3}
157 ; CHECK-NEXT: .p2align 2
158 ; CHECK-NEXT: @ %bb.7:
159 ; CHECK-NEXT: .LCPI4_0:
160 ; CHECK-NEXT: .long 683 @ 0x2ab
161 ; CHECK-NEXT: .LCPI4_1:
162 ; CHECK-NEXT: .long 2044 @ 0x7fc
163 ; CHECK-NEXT: .LCPI4_2:
164 ; CHECK-NEXT: .long 2046 @ 0x7fe
165 ; CHECK-NEXT: .LCPI4_3:
166 ; CHECK-NEXT: .long 3068133376 @ 0xb6e00000
167 ; CHECK-NEXT: .LCPI4_4:
168 ; CHECK-NEXT: .long 819 @ 0x333
169 ; CHECK-NEXT: .LCPI4_5:
170 ; CHECK-NEXT: .long 2047 @ 0x7ff
171 %urem = urem <3 x i11> %X, <i11 6, i11 7, i11 -5>
172 %cmp = icmp ne <3 x i11> %urem, <i11 0, i11 1, i11 2>