1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv7-none-eabi < %s | FileCheck %s
4 define i1 @test_srem_odd(i29 %X) nounwind {
5 ; CHECK-LABEL: test_srem_odd:
7 ; CHECK-NEXT: movw r1, #24493
8 ; CHECK-NEXT: movw r2, #33099
9 ; CHECK-NEXT: movt r1, #41
10 ; CHECK-NEXT: movt r2, #8026
11 ; CHECK-NEXT: mla r0, r0, r2, r1
12 ; CHECK-NEXT: movw r2, #48987
13 ; CHECK-NEXT: movt r2, #82
14 ; CHECK-NEXT: bic r1, r0, #-536870912
15 ; CHECK-NEXT: movs r0, #0
16 ; CHECK-NEXT: cmp r1, r2
18 ; CHECK-NEXT: movlo r0, #1
20 %srem = srem i29 %X, 99
21 %cmp = icmp eq i29 %srem, 0
25 define i1 @test_srem_even(i4 %X) nounwind {
26 ; CHECK-LABEL: test_srem_even:
28 ; CHECK-NEXT: movw r2, #43691
29 ; CHECK-NEXT: sbfx r1, r0, #0, #4
30 ; CHECK-NEXT: movt r2, #10922
31 ; CHECK-NEXT: lsls r0, r0, #28
32 ; CHECK-NEXT: smmul r1, r1, r2
33 ; CHECK-NEXT: add.w r1, r1, r1, lsr #31
34 ; CHECK-NEXT: add.w r1, r1, r1, lsl #1
35 ; CHECK-NEXT: mvn.w r1, r1, lsl #1
36 ; CHECK-NEXT: add.w r0, r1, r0, asr #28
37 ; CHECK-NEXT: clz r0, r0
38 ; CHECK-NEXT: lsrs r0, r0, #5
41 %cmp = icmp eq i4 %srem, 1
45 define i1 @test_srem_pow2_setne(i6 %X) nounwind {
46 ; CHECK-LABEL: test_srem_pow2_setne:
48 ; CHECK-NEXT: sbfx r1, r0, #0, #6
49 ; CHECK-NEXT: ubfx r1, r1, #9, #2
50 ; CHECK-NEXT: add r1, r0
51 ; CHECK-NEXT: and r1, r1, #60
52 ; CHECK-NEXT: subs r0, r0, r1
53 ; CHECK-NEXT: ands r0, r0, #63
55 ; CHECK-NEXT: movne r0, #1
58 %cmp = icmp ne i6 %srem, 0
62 define <3 x i1> @test_srem_vec(<3 x i33> %X) nounwind {
63 ; CHECK-LABEL: test_srem_vec:
65 ; CHECK-NEXT: .save {r4, r5, r6, r7, lr}
66 ; CHECK-NEXT: push {r4, r5, r6, r7, lr}
68 ; CHECK-NEXT: sub sp, #4
69 ; CHECK-NEXT: .vsave {d8, d9}
70 ; CHECK-NEXT: vpush {d8, d9}
71 ; CHECK-NEXT: mov r5, r0
72 ; CHECK-NEXT: and r0, r3, #1
73 ; CHECK-NEXT: mov r4, r1
74 ; CHECK-NEXT: rsbs r1, r0, #0
75 ; CHECK-NEXT: mov r0, r2
76 ; CHECK-NEXT: movs r2, #9
77 ; CHECK-NEXT: movs r3, #0
78 ; CHECK-NEXT: bl __aeabi_ldivmod
79 ; CHECK-NEXT: and r0, r4, #1
80 ; CHECK-NEXT: mov r6, r2
81 ; CHECK-NEXT: rsbs r1, r0, #0
82 ; CHECK-NEXT: mov r7, r3
83 ; CHECK-NEXT: mov r0, r5
84 ; CHECK-NEXT: movs r2, #9
85 ; CHECK-NEXT: movs r3, #0
86 ; CHECK-NEXT: bl __aeabi_ldivmod
87 ; CHECK-NEXT: ldr r1, [sp, #44]
88 ; CHECK-NEXT: vmov.32 d8[0], r2
89 ; CHECK-NEXT: ldr r0, [sp, #40]
90 ; CHECK-NEXT: mov r4, r3
91 ; CHECK-NEXT: and r1, r1, #1
92 ; CHECK-NEXT: mvn r2, #8
93 ; CHECK-NEXT: rsbs r1, r1, #0
94 ; CHECK-NEXT: mov.w r3, #-1
95 ; CHECK-NEXT: vmov.32 d9[0], r6
96 ; CHECK-NEXT: bl __aeabi_ldivmod
97 ; CHECK-NEXT: vmov.32 d16[0], r2
98 ; CHECK-NEXT: adr r0, .LCPI3_0
99 ; CHECK-NEXT: vmov.32 d9[1], r7
100 ; CHECK-NEXT: vld1.64 {d18, d19}, [r0:128]
101 ; CHECK-NEXT: adr r0, .LCPI3_1
102 ; CHECK-NEXT: vmov.32 d16[1], r3
103 ; CHECK-NEXT: vmov.32 d8[1], r4
104 ; CHECK-NEXT: vand q8, q8, q9
105 ; CHECK-NEXT: vld1.64 {d20, d21}, [r0:128]
106 ; CHECK-NEXT: adr r0, .LCPI3_2
107 ; CHECK-NEXT: vand q11, q4, q9
108 ; CHECK-NEXT: vld1.64 {d18, d19}, [r0:128]
109 ; CHECK-NEXT: vceq.i32 q10, q11, q10
110 ; CHECK-NEXT: vceq.i32 q8, q8, q9
111 ; CHECK-NEXT: vrev64.32 q9, q10
112 ; CHECK-NEXT: vrev64.32 q11, q8
113 ; CHECK-NEXT: vand q9, q10, q9
114 ; CHECK-NEXT: vand q8, q8, q11
115 ; CHECK-NEXT: vmvn q9, q9
116 ; CHECK-NEXT: vmvn q8, q8
117 ; CHECK-NEXT: vmovn.i64 d18, q9
118 ; CHECK-NEXT: vmovn.i64 d16, q8
119 ; CHECK-NEXT: vmov.32 r0, d18[0]
120 ; CHECK-NEXT: vmov.32 r1, d18[1]
121 ; CHECK-NEXT: vmov.32 r2, d16[0]
122 ; CHECK-NEXT: vpop {d8, d9}
123 ; CHECK-NEXT: add sp, #4
124 ; CHECK-NEXT: pop {r4, r5, r6, r7, pc}
125 ; CHECK-NEXT: .p2align 4
126 ; CHECK-NEXT: @ %bb.1:
127 ; CHECK-NEXT: .LCPI3_0:
128 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
129 ; CHECK-NEXT: .long 1 @ 0x1
130 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
131 ; CHECK-NEXT: .long 1 @ 0x1
132 ; CHECK-NEXT: .LCPI3_1:
133 ; CHECK-NEXT: .long 3 @ 0x3
134 ; CHECK-NEXT: .long 0 @ 0x0
135 ; CHECK-NEXT: .long 4294967293 @ 0xfffffffd
136 ; CHECK-NEXT: .long 1 @ 0x1
137 ; CHECK-NEXT: .LCPI3_2:
138 ; CHECK-NEXT: .long 3 @ 0x3
139 ; CHECK-NEXT: .long 0 @ 0x0
140 ; CHECK-NEXT: .zero 4
141 ; CHECK-NEXT: .long 0 @ 0x0
142 %srem = srem <3 x i33> %X, <i33 9, i33 9, i33 -9>
143 %cmp = icmp ne <3 x i33> %srem, <i33 3, i33 -3, i33 3>