llvm.org GIT mirror llvm / 68b7d2e
[ARM] Add qadd lowering from a sadd_sat This lowers a sadd_sat to a qadd by treating it as legal. Also adds qsub at the same time. The qadd instruction sets the q flag, but we already have many cases where we do not model this in llvm. Differential Revision: https://reviews.llvm.org/D68976 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375411 91177308-0d34-0410-b5e6-96231b3b80d8 David Green 1 year, 1 month ago
9 changed file(s) with 600 addition(s) and 616 deletion(s). Raw diff Collapse all Expand all
10261026 setOperationAction(ISD::SADDSAT, MVT::i16, Custom);
10271027 setOperationAction(ISD::SSUBSAT, MVT::i16, Custom);
10281028 }
1029 if (Subtarget->hasBaseDSP()) {
1030 setOperationAction(ISD::SADDSAT, MVT::i32, Legal);
1031 setOperationAction(ISD::SSUBSAT, MVT::i32, Legal);
1032 }
10291033
10301034 // i64 operation support.
10311035 setOperationAction(ISD::MUL, MVT::i64, Expand);
1108911093 static SDValue AddCombineTo64BitSMLAL16(SDNode *AddcNode, SDNode *AddeNode,
1109011094 TargetLowering::DAGCombinerInfo &DCI,
1109111095 const ARMSubtarget *Subtarget) {
11092 if (Subtarget->isThumb()) {
11093 if (!Subtarget->hasDSP())
11094 return SDValue();
11095 } else if (!Subtarget->hasV5TEOps())
11096 if (!Subtarget->hasBaseDSP())
1109611097 return SDValue();
1109711098
1109811099 // SMLALBB, SMLALBT, SMLALTB, SMLALTT multiply two 16-bit values and
37543754 [(set GPRnopc:$Rd, (int_arm_qadd GPRnopc:$Rm, GPRnopc:$Rn))]>;
37553755 }
37563756
3757 def : ARMV5TEPat<(saddsat GPR:$a, GPR:$b),
3758 (QADD GPR:$a, GPR:$b)>;
3759 def : ARMV5TEPat<(ssubsat GPR:$a, GPR:$b),
3760 (QSUB GPR:$a, GPR:$b)>;
37573761 def : ARMV6Pat<(ARMqadd8b rGPR:$Rm, rGPR:$Rn),
37583762 (QADD8 rGPR:$Rm, rGPR:$Rn)>;
37593763 def : ARMV6Pat<(ARMqsub8b rGPR:$Rm, rGPR:$Rn),
23942394 def : Thumb2DSPPat<(int_arm_qsub rGPR:$Rm, (int_arm_qadd rGPR:$Rn, rGPR:$Rn)),
23952395 (t2QDSUB rGPR:$Rm, rGPR:$Rn)>;
23962396
2397 def : Thumb2DSPPat<(saddsat rGPR:$Rm, rGPR:$Rn),
2398 (t2QADD rGPR:$Rm, rGPR:$Rn)>;
2399 def : Thumb2DSPPat<(ssubsat rGPR:$Rm, rGPR:$Rn),
2400 (t2QSUB rGPR:$Rm, rGPR:$Rn)>;
23972401 def : Thumb2DSPPat<(ARMqadd8b rGPR:$Rm, rGPR:$Rn),
23982402 (t2QADD8 rGPR:$Rm, rGPR:$Rn)>;
23992403 def : Thumb2DSPPat<(ARMqsub8b rGPR:$Rm, rGPR:$Rn),
671671 bool hasSB() const { return HasSB; }
672672 bool genLongCalls() const { return GenLongCalls; }
673673 bool genExecuteOnly() const { return GenExecuteOnly; }
674 bool hasBaseDSP() const {
675 if (isThumb())
676 return hasDSP();
677 else
678 return hasV5TEOps();
679 }
674680
675681 bool hasFP16() const { return HasFP16; }
676682 bool hasD32() const { return HasD32; }
44 ; RUN: llc < %s -mtriple=armv8a-none-eabi | FileCheck %s --check-prefix=CHECK-ARM --check-prefix=CHECK-ARM8
55
66 define i32 @qdadd(i32 %x, i32 %y) nounwind {
7 ; CHECK-T2-LABEL: qdadd:
8 ; CHECK-T2: @ %bb.0:
9 ; CHECK-T2-NEXT: .save {r7, lr}
10 ; CHECK-T2-NEXT: push {r7, lr}
11 ; CHECK-T2-NEXT: movs r3, #0
12 ; CHECK-T2-NEXT: adds.w r12, r0, r0
13 ; CHECK-T2-NEXT: it mi
14 ; CHECK-T2-NEXT: movmi r3, #1
15 ; CHECK-T2-NEXT: cmp r3, #0
16 ; CHECK-T2-NEXT: mov.w r3, #-2147483648
17 ; CHECK-T2-NEXT: mov.w lr, #0
18 ; CHECK-T2-NEXT: it ne
19 ; CHECK-T2-NEXT: mvnne r3, #-2147483648
20 ; CHECK-T2-NEXT: cmp r12, r0
21 ; CHECK-T2-NEXT: it vc
22 ; CHECK-T2-NEXT: movvc r3, r12
23 ; CHECK-T2-NEXT: adds r0, r3, r1
24 ; CHECK-T2-NEXT: mov.w r2, #-2147483648
25 ; CHECK-T2-NEXT: it mi
26 ; CHECK-T2-NEXT: movmi.w lr, #1
27 ; CHECK-T2-NEXT: cmp.w lr, #0
28 ; CHECK-T2-NEXT: it ne
29 ; CHECK-T2-NEXT: mvnne r2, #-2147483648
30 ; CHECK-T2-NEXT: cmp r0, r3
31 ; CHECK-T2-NEXT: it vc
32 ; CHECK-T2-NEXT: movvc r2, r0
33 ; CHECK-T2-NEXT: mov r0, r2
34 ; CHECK-T2-NEXT: pop {r7, pc}
7 ; CHECK-T2NODSP-LABEL: qdadd:
8 ; CHECK-T2NODSP: @ %bb.0:
9 ; CHECK-T2NODSP-NEXT: .save {r7, lr}
10 ; CHECK-T2NODSP-NEXT: push {r7, lr}
11 ; CHECK-T2NODSP-NEXT: movs r3, #0
12 ; CHECK-T2NODSP-NEXT: adds.w r12, r0, r0
13 ; CHECK-T2NODSP-NEXT: it mi
14 ; CHECK-T2NODSP-NEXT: movmi r3, #1
15 ; CHECK-T2NODSP-NEXT: cmp r3, #0
16 ; CHECK-T2NODSP-NEXT: mov.w r3, #-2147483648
17 ; CHECK-T2NODSP-NEXT: mov.w lr, #0
18 ; CHECK-T2NODSP-NEXT: it ne
19 ; CHECK-T2NODSP-NEXT: mvnne r3, #-2147483648
20 ; CHECK-T2NODSP-NEXT: cmp r12, r0
21 ; CHECK-T2NODSP-NEXT: it vc
22 ; CHECK-T2NODSP-NEXT: movvc r3, r12
23 ; CHECK-T2NODSP-NEXT: adds r0, r3, r1
24 ; CHECK-T2NODSP-NEXT: mov.w r2, #-2147483648
25 ; CHECK-T2NODSP-NEXT: it mi
26 ; CHECK-T2NODSP-NEXT: movmi.w lr, #1
27 ; CHECK-T2NODSP-NEXT: cmp.w lr, #0
28 ; CHECK-T2NODSP-NEXT: it ne
29 ; CHECK-T2NODSP-NEXT: mvnne r2, #-2147483648
30 ; CHECK-T2NODSP-NEXT: cmp r0, r3
31 ; CHECK-T2NODSP-NEXT: it vc
32 ; CHECK-T2NODSP-NEXT: movvc r2, r0
33 ; CHECK-T2NODSP-NEXT: mov r0, r2
34 ; CHECK-T2NODSP-NEXT: pop {r7, pc}
3535 ;
36 ; CHECK-ARM6-LABEL: qdadd:
37 ; CHECK-ARM6: @ %bb.0:
38 ; CHECK-ARM6-NEXT: .save {r11, lr}
39 ; CHECK-ARM6-NEXT: push {r11, lr}
40 ; CHECK-ARM6-NEXT: adds r12, r0, r0
41 ; CHECK-ARM6-NEXT: mov r3, #0
42 ; CHECK-ARM6-NEXT: movmi r3, #1
43 ; CHECK-ARM6-NEXT: cmp r3, #0
44 ; CHECK-ARM6-NEXT: mov r3, #-2147483648
45 ; CHECK-ARM6-NEXT: mov lr, #0
46 ; CHECK-ARM6-NEXT: mvnne r3, #-2147483648
47 ; CHECK-ARM6-NEXT: cmp r12, r0
48 ; CHECK-ARM6-NEXT: movvc r3, r12
49 ; CHECK-ARM6-NEXT: adds r0, r3, r1
50 ; CHECK-ARM6-NEXT: movmi lr, #1
51 ; CHECK-ARM6-NEXT: mov r2, #-2147483648
52 ; CHECK-ARM6-NEXT: cmp lr, #0
53 ; CHECK-ARM6-NEXT: mvnne r2, #-2147483648
54 ; CHECK-ARM6-NEXT: cmp r0, r3
55 ; CHECK-ARM6-NEXT: movvc r2, r0
56 ; CHECK-ARM6-NEXT: mov r0, r2
57 ; CHECK-ARM6-NEXT: pop {r11, pc}
36 ; CHECK-T2DSP-LABEL: qdadd:
37 ; CHECK-T2DSP: @ %bb.0:
38 ; CHECK-T2DSP-NEXT: qadd r0, r0, r0
39 ; CHECK-T2DSP-NEXT: qadd r0, r0, r1
40 ; CHECK-T2DSP-NEXT: bx lr
5841 ;
59 ; CHECK-ARM8-LABEL: qdadd:
60 ; CHECK-ARM8: @ %bb.0:
61 ; CHECK-ARM8-NEXT: .save {r11, lr}
62 ; CHECK-ARM8-NEXT: push {r11, lr}
63 ; CHECK-ARM8-NEXT: adds r12, r0, r0
64 ; CHECK-ARM8-NEXT: mov r3, #0
65 ; CHECK-ARM8-NEXT: movwmi r3, #1
66 ; CHECK-ARM8-NEXT: cmp r3, #0
67 ; CHECK-ARM8-NEXT: mov r3, #-2147483648
68 ; CHECK-ARM8-NEXT: mov lr, #0
69 ; CHECK-ARM8-NEXT: mvnne r3, #-2147483648
70 ; CHECK-ARM8-NEXT: cmp r12, r0
71 ; CHECK-ARM8-NEXT: movvc r3, r12
72 ; CHECK-ARM8-NEXT: adds r0, r3, r1
73 ; CHECK-ARM8-NEXT: movwmi lr, #1
74 ; CHECK-ARM8-NEXT: mov r2, #-2147483648
75 ; CHECK-ARM8-NEXT: cmp lr, #0
76 ; CHECK-ARM8-NEXT: mvnne r2, #-2147483648
77 ; CHECK-ARM8-NEXT: cmp r0, r3
78 ; CHECK-ARM8-NEXT: movvc r2, r0
79 ; CHECK-ARM8-NEXT: mov r0, r2
80 ; CHECK-ARM8-NEXT: pop {r11, pc}
42 ; CHECK-ARM-LABEL: qdadd:
43 ; CHECK-ARM: @ %bb.0:
44 ; CHECK-ARM-NEXT: qadd r0, r0, r0
45 ; CHECK-ARM-NEXT: qadd r0, r0, r1
46 ; CHECK-ARM-NEXT: bx lr
8147 %z = call i32 @llvm.sadd.sat.i32(i32 %x, i32 %x)
8248 %tmp = call i32 @llvm.sadd.sat.i32(i32 %z, i32 %y)
8349 ret i32 %tmp
8450 }
8551
8652 define i32 @qdadd_c(i32 %x, i32 %y) nounwind {
87 ; CHECK-T2-LABEL: qdadd_c:
88 ; CHECK-T2: @ %bb.0:
89 ; CHECK-T2-NEXT: .save {r7, lr}
90 ; CHECK-T2-NEXT: push {r7, lr}
91 ; CHECK-T2-NEXT: movs r3, #0
92 ; CHECK-T2-NEXT: adds.w r12, r0, r0
93 ; CHECK-T2-NEXT: it mi
94 ; CHECK-T2-NEXT: movmi r3, #1
95 ; CHECK-T2-NEXT: cmp r3, #0
96 ; CHECK-T2-NEXT: mov.w r3, #-2147483648
97 ; CHECK-T2-NEXT: mov.w lr, #0
98 ; CHECK-T2-NEXT: it ne
99 ; CHECK-T2-NEXT: mvnne r3, #-2147483648
100 ; CHECK-T2-NEXT: cmp r12, r0
101 ; CHECK-T2-NEXT: it vc
102 ; CHECK-T2-NEXT: movvc r3, r12
103 ; CHECK-T2-NEXT: adds r0, r1, r3
104 ; CHECK-T2-NEXT: mov.w r2, #-2147483648
105 ; CHECK-T2-NEXT: it mi
106 ; CHECK-T2-NEXT: movmi.w lr, #1
107 ; CHECK-T2-NEXT: cmp.w lr, #0
108 ; CHECK-T2-NEXT: it ne
109 ; CHECK-T2-NEXT: mvnne r2, #-2147483648
110 ; CHECK-T2-NEXT: cmp r0, r1
111 ; CHECK-T2-NEXT: it vc
112 ; CHECK-T2-NEXT: movvc r2, r0
113 ; CHECK-T2-NEXT: mov r0, r2
114 ; CHECK-T2-NEXT: pop {r7, pc}
53 ; CHECK-T2NODSP-LABEL: qdadd_c:
54 ; CHECK-T2NODSP: @ %bb.0:
55 ; CHECK-T2NODSP-NEXT: .save {r7, lr}
56 ; CHECK-T2NODSP-NEXT: push {r7, lr}
57 ; CHECK-T2NODSP-NEXT: movs r3, #0
58 ; CHECK-T2NODSP-NEXT: adds.w r12, r0, r0
59 ; CHECK-T2NODSP-NEXT: it mi
60 ; CHECK-T2NODSP-NEXT: movmi r3, #1
61 ; CHECK-T2NODSP-NEXT: cmp r3, #0
62 ; CHECK-T2NODSP-NEXT: mov.w r3, #-2147483648
63 ; CHECK-T2NODSP-NEXT: mov.w lr, #0
64 ; CHECK-T2NODSP-NEXT: it ne
65 ; CHECK-T2NODSP-NEXT: mvnne r3, #-2147483648
66 ; CHECK-T2NODSP-NEXT: cmp r12, r0
67 ; CHECK-T2NODSP-NEXT: it vc
68 ; CHECK-T2NODSP-NEXT: movvc r3, r12
69 ; CHECK-T2NODSP-NEXT: adds r0, r1, r3
70 ; CHECK-T2NODSP-NEXT: mov.w r2, #-2147483648
71 ; CHECK-T2NODSP-NEXT: it mi
72 ; CHECK-T2NODSP-NEXT: movmi.w lr, #1
73 ; CHECK-T2NODSP-NEXT: cmp.w lr, #0
74 ; CHECK-T2NODSP-NEXT: it ne
75 ; CHECK-T2NODSP-NEXT: mvnne r2, #-2147483648
76 ; CHECK-T2NODSP-NEXT: cmp r0, r1
77 ; CHECK-T2NODSP-NEXT: it vc
78 ; CHECK-T2NODSP-NEXT: movvc r2, r0
79 ; CHECK-T2NODSP-NEXT: mov r0, r2
80 ; CHECK-T2NODSP-NEXT: pop {r7, pc}
11581 ;
116 ; CHECK-ARM6-LABEL: qdadd_c:
117 ; CHECK-ARM6: @ %bb.0:
118 ; CHECK-ARM6-NEXT: .save {r11, lr}
119 ; CHECK-ARM6-NEXT: push {r11, lr}
120 ; CHECK-ARM6-NEXT: adds r12, r0, r0
121 ; CHECK-ARM6-NEXT: mov r3, #0
122 ; CHECK-ARM6-NEXT: movmi r3, #1
123 ; CHECK-ARM6-NEXT: cmp r3, #0
124 ; CHECK-ARM6-NEXT: mov r3, #-2147483648
125 ; CHECK-ARM6-NEXT: mov lr, #0
126 ; CHECK-ARM6-NEXT: mvnne r3, #-2147483648
127 ; CHECK-ARM6-NEXT: cmp r12, r0
128 ; CHECK-ARM6-NEXT: movvc r3, r12
129 ; CHECK-ARM6-NEXT: adds r0, r1, r3
130 ; CHECK-ARM6-NEXT: movmi lr, #1
131 ; CHECK-ARM6-NEXT: mov r2, #-2147483648
132 ; CHECK-ARM6-NEXT: cmp lr, #0
133 ; CHECK-ARM6-NEXT: mvnne r2, #-2147483648
134 ; CHECK-ARM6-NEXT: cmp r0, r1
135 ; CHECK-ARM6-NEXT: movvc r2, r0
136 ; CHECK-ARM6-NEXT: mov r0, r2
137 ; CHECK-ARM6-NEXT: pop {r11, pc}
82 ; CHECK-T2DSP-LABEL: qdadd_c:
83 ; CHECK-T2DSP: @ %bb.0:
84 ; CHECK-T2DSP-NEXT: qadd r0, r0, r0
85 ; CHECK-T2DSP-NEXT: qadd r0, r1, r0
86 ; CHECK-T2DSP-NEXT: bx lr
13887 ;
139 ; CHECK-ARM8-LABEL: qdadd_c:
140 ; CHECK-ARM8: @ %bb.0:
141 ; CHECK-ARM8-NEXT: .save {r11, lr}
142 ; CHECK-ARM8-NEXT: push {r11, lr}
143 ; CHECK-ARM8-NEXT: adds r12, r0, r0
144 ; CHECK-ARM8-NEXT: mov r3, #0
145 ; CHECK-ARM8-NEXT: movwmi r3, #1
146 ; CHECK-ARM8-NEXT: cmp r3, #0
147 ; CHECK-ARM8-NEXT: mov r3, #-2147483648
148 ; CHECK-ARM8-NEXT: mov lr, #0
149 ; CHECK-ARM8-NEXT: mvnne r3, #-2147483648
150 ; CHECK-ARM8-NEXT: cmp r12, r0
151 ; CHECK-ARM8-NEXT: movvc r3, r12
152 ; CHECK-ARM8-NEXT: adds r0, r1, r3
153 ; CHECK-ARM8-NEXT: movwmi lr, #1
154 ; CHECK-ARM8-NEXT: mov r2, #-2147483648
155 ; CHECK-ARM8-NEXT: cmp lr, #0
156 ; CHECK-ARM8-NEXT: mvnne r2, #-2147483648
157 ; CHECK-ARM8-NEXT: cmp r0, r1
158 ; CHECK-ARM8-NEXT: movvc r2, r0
159 ; CHECK-ARM8-NEXT: mov r0, r2
160 ; CHECK-ARM8-NEXT: pop {r11, pc}
88 ; CHECK-ARM-LABEL: qdadd_c:
89 ; CHECK-ARM: @ %bb.0:
90 ; CHECK-ARM-NEXT: qadd r0, r0, r0
91 ; CHECK-ARM-NEXT: qadd r0, r1, r0
92 ; CHECK-ARM-NEXT: bx lr
16193 %z = call i32 @llvm.sadd.sat.i32(i32 %x, i32 %x)
16294 %tmp = call i32 @llvm.sadd.sat.i32(i32 %y, i32 %z)
16395 ret i32 %tmp
16496 }
16597
16698 define i32 @qdsub(i32 %x, i32 %y) nounwind {
167 ; CHECK-T2-LABEL: qdsub:
168 ; CHECK-T2: @ %bb.0:
169 ; CHECK-T2-NEXT: .save {r7, lr}
170 ; CHECK-T2-NEXT: push {r7, lr}
171 ; CHECK-T2-NEXT: movs r3, #0
172 ; CHECK-T2-NEXT: adds.w r12, r0, r0
173 ; CHECK-T2-NEXT: it mi
174 ; CHECK-T2-NEXT: movmi r3, #1
175 ; CHECK-T2-NEXT: cmp r3, #0
176 ; CHECK-T2-NEXT: mov.w r3, #-2147483648
177 ; CHECK-T2-NEXT: mov.w lr, #0
178 ; CHECK-T2-NEXT: it ne
179 ; CHECK-T2-NEXT: mvnne r3, #-2147483648
180 ; CHECK-T2-NEXT: cmp r12, r0
181 ; CHECK-T2-NEXT: it vc
182 ; CHECK-T2-NEXT: movvc r3, r12
183 ; CHECK-T2-NEXT: subs r0, r1, r3
184 ; CHECK-T2-NEXT: mov.w r2, #-2147483648
185 ; CHECK-T2-NEXT: it mi
186 ; CHECK-T2-NEXT: movmi.w lr, #1
187 ; CHECK-T2-NEXT: cmp.w lr, #0
188 ; CHECK-T2-NEXT: it ne
189 ; CHECK-T2-NEXT: mvnne r2, #-2147483648
190 ; CHECK-T2-NEXT: cmp r1, r3
191 ; CHECK-T2-NEXT: it vc
192 ; CHECK-T2-NEXT: movvc r2, r0
193 ; CHECK-T2-NEXT: mov r0, r2
194 ; CHECK-T2-NEXT: pop {r7, pc}
99 ; CHECK-T2NODSP-LABEL: qdsub:
100 ; CHECK-T2NODSP: @ %bb.0:
101 ; CHECK-T2NODSP-NEXT: .save {r7, lr}
102 ; CHECK-T2NODSP-NEXT: push {r7, lr}
103 ; CHECK-T2NODSP-NEXT: movs r3, #0
104 ; CHECK-T2NODSP-NEXT: adds.w r12, r0, r0
105 ; CHECK-T2NODSP-NEXT: it mi
106 ; CHECK-T2NODSP-NEXT: movmi r3, #1
107 ; CHECK-T2NODSP-NEXT: cmp r3, #0
108 ; CHECK-T2NODSP-NEXT: mov.w r3, #-2147483648
109 ; CHECK-T2NODSP-NEXT: mov.w lr, #0
110 ; CHECK-T2NODSP-NEXT: it ne
111 ; CHECK-T2NODSP-NEXT: mvnne r3, #-2147483648
112 ; CHECK-T2NODSP-NEXT: cmp r12, r0
113 ; CHECK-T2NODSP-NEXT: it vc
114 ; CHECK-T2NODSP-NEXT: movvc r3, r12
115 ; CHECK-T2NODSP-NEXT: subs r0, r1, r3
116 ; CHECK-T2NODSP-NEXT: mov.w r2, #-2147483648
117 ; CHECK-T2NODSP-NEXT: it mi
118 ; CHECK-T2NODSP-NEXT: movmi.w lr, #1
119 ; CHECK-T2NODSP-NEXT: cmp.w lr, #0
120 ; CHECK-T2NODSP-NEXT: it ne
121 ; CHECK-T2NODSP-NEXT: mvnne r2, #-2147483648
122 ; CHECK-T2NODSP-NEXT: cmp r1, r3
123 ; CHECK-T2NODSP-NEXT: it vc
124 ; CHECK-T2NODSP-NEXT: movvc r2, r0
125 ; CHECK-T2NODSP-NEXT: mov r0, r2
126 ; CHECK-T2NODSP-NEXT: pop {r7, pc}
195127 ;
196 ; CHECK-ARM6-LABEL: qdsub:
197 ; CHECK-ARM6: @ %bb.0:
198 ; CHECK-ARM6-NEXT: .save {r11, lr}
199 ; CHECK-ARM6-NEXT: push {r11, lr}
200 ; CHECK-ARM6-NEXT: adds r12, r0, r0
201 ; CHECK-ARM6-NEXT: mov r3, #0
202 ; CHECK-ARM6-NEXT: movmi r3, #1
203 ; CHECK-ARM6-NEXT: cmp r3, #0
204 ; CHECK-ARM6-NEXT: mov r3, #-2147483648
205 ; CHECK-ARM6-NEXT: mov lr, #0
206 ; CHECK-ARM6-NEXT: mvnne r3, #-2147483648
207 ; CHECK-ARM6-NEXT: cmp r12, r0
208 ; CHECK-ARM6-NEXT: movvc r3, r12
209 ; CHECK-ARM6-NEXT: subs r0, r1, r3
210 ; CHECK-ARM6-NEXT: movmi lr, #1
211 ; CHECK-ARM6-NEXT: mov r2, #-2147483648
212 ; CHECK-ARM6-NEXT: cmp lr, #0
213 ; CHECK-ARM6-NEXT: mvnne r2, #-2147483648
214 ; CHECK-ARM6-NEXT: cmp r1, r3
215 ; CHECK-ARM6-NEXT: movvc r2, r0
216 ; CHECK-ARM6-NEXT: mov r0, r2
217 ; CHECK-ARM6-NEXT: pop {r11, pc}
128 ; CHECK-T2DSP-LABEL: qdsub:
129 ; CHECK-T2DSP: @ %bb.0:
130 ; CHECK-T2DSP-NEXT: qadd r0, r0, r0
131 ; CHECK-T2DSP-NEXT: qsub r0, r1, r0
132 ; CHECK-T2DSP-NEXT: bx lr
218133 ;
219 ; CHECK-ARM8-LABEL: qdsub:
220 ; CHECK-ARM8: @ %bb.0:
221 ; CHECK-ARM8-NEXT: .save {r11, lr}
222 ; CHECK-ARM8-NEXT: push {r11, lr}
223 ; CHECK-ARM8-NEXT: adds r12, r0, r0
224 ; CHECK-ARM8-NEXT: mov r3, #0
225 ; CHECK-ARM8-NEXT: movwmi r3, #1
226 ; CHECK-ARM8-NEXT: cmp r3, #0
227 ; CHECK-ARM8-NEXT: mov r3, #-2147483648
228 ; CHECK-ARM8-NEXT: mov lr, #0
229 ; CHECK-ARM8-NEXT: mvnne r3, #-2147483648
230 ; CHECK-ARM8-NEXT: cmp r12, r0
231 ; CHECK-ARM8-NEXT: movvc r3, r12
232 ; CHECK-ARM8-NEXT: subs r0, r1, r3
233 ; CHECK-ARM8-NEXT: movwmi lr, #1
234 ; CHECK-ARM8-NEXT: mov r2, #-2147483648
235 ; CHECK-ARM8-NEXT: cmp lr, #0
236 ; CHECK-ARM8-NEXT: mvnne r2, #-2147483648
237 ; CHECK-ARM8-NEXT: cmp r1, r3
238 ; CHECK-ARM8-NEXT: movvc r2, r0
239 ; CHECK-ARM8-NEXT: mov r0, r2
240 ; CHECK-ARM8-NEXT: pop {r11, pc}
134 ; CHECK-ARM-LABEL: qdsub:
135 ; CHECK-ARM: @ %bb.0:
136 ; CHECK-ARM-NEXT: qadd r0, r0, r0
137 ; CHECK-ARM-NEXT: qsub r0, r1, r0
138 ; CHECK-ARM-NEXT: bx lr
241139 %z = call i32 @llvm.sadd.sat.i32(i32 %x, i32 %x)
242140 %tmp = call i32 @llvm.ssub.sat.i32(i32 %y, i32 %z)
243141 ret i32 %tmp
244142 }
245143
246144 define i32 @qdsub_c(i32 %x, i32 %y) nounwind {
247 ; CHECK-T2-LABEL: qdsub_c:
248 ; CHECK-T2: @ %bb.0:
249 ; CHECK-T2-NEXT: .save {r7, lr}
250 ; CHECK-T2-NEXT: push {r7, lr}
251 ; CHECK-T2-NEXT: movs r3, #0
252 ; CHECK-T2-NEXT: adds.w r12, r0, r0
253 ; CHECK-T2-NEXT: it mi
254 ; CHECK-T2-NEXT: movmi r3, #1
255 ; CHECK-T2-NEXT: cmp r3, #0
256 ; CHECK-T2-NEXT: mov.w r3, #-2147483648
257 ; CHECK-T2-NEXT: mov.w lr, #0
258 ; CHECK-T2-NEXT: it ne
259 ; CHECK-T2-NEXT: mvnne r3, #-2147483648
260 ; CHECK-T2-NEXT: cmp r12, r0
261 ; CHECK-T2-NEXT: it vc
262 ; CHECK-T2-NEXT: movvc r3, r12
263 ; CHECK-T2-NEXT: subs r0, r3, r1
264 ; CHECK-T2-NEXT: mov.w r2, #-2147483648
265 ; CHECK-T2-NEXT: it mi
266 ; CHECK-T2-NEXT: movmi.w lr, #1
267 ; CHECK-T2-NEXT: cmp.w lr, #0
268 ; CHECK-T2-NEXT: it ne
269 ; CHECK-T2-NEXT: mvnne r2, #-2147483648
270 ; CHECK-T2-NEXT: cmp r3, r1
271 ; CHECK-T2-NEXT: it vc
272 ; CHECK-T2-NEXT: movvc r2, r0
273 ; CHECK-T2-NEXT: mov r0, r2
274 ; CHECK-T2-NEXT: pop {r7, pc}
145 ; CHECK-T2NODSP-LABEL: qdsub_c:
146 ; CHECK-T2NODSP: @ %bb.0:
147 ; CHECK-T2NODSP-NEXT: .save {r7, lr}
148 ; CHECK-T2NODSP-NEXT: push {r7, lr}
149 ; CHECK-T2NODSP-NEXT: movs r3, #0
150 ; CHECK-T2NODSP-NEXT: adds.w r12, r0, r0
151 ; CHECK-T2NODSP-NEXT: it mi
152 ; CHECK-T2NODSP-NEXT: movmi r3, #1
153 ; CHECK-T2NODSP-NEXT: cmp r3, #0
154 ; CHECK-T2NODSP-NEXT: mov.w r3, #-2147483648
155 ; CHECK-T2NODSP-NEXT: mov.w lr, #0
156 ; CHECK-T2NODSP-NEXT: it ne
157 ; CHECK-T2NODSP-NEXT: mvnne r3, #-2147483648
158 ; CHECK-T2NODSP-NEXT: cmp r12, r0
159 ; CHECK-T2NODSP-NEXT: it vc
160 ; CHECK-T2NODSP-NEXT: movvc r3, r12
161 ; CHECK-T2NODSP-NEXT: subs r0, r3, r1
162 ; CHECK-T2NODSP-NEXT: mov.w r2, #-2147483648
163 ; CHECK-T2NODSP-NEXT: it mi
164 ; CHECK-T2NODSP-NEXT: movmi.w lr, #1
165 ; CHECK-T2NODSP-NEXT: cmp.w lr, #0
166 ; CHECK-T2NODSP-NEXT: it ne
167 ; CHECK-T2NODSP-NEXT: mvnne r2, #-2147483648
168 ; CHECK-T2NODSP-NEXT: cmp r3, r1
169 ; CHECK-T2NODSP-NEXT: it vc
170 ; CHECK-T2NODSP-NEXT: movvc r2, r0
171 ; CHECK-T2NODSP-NEXT: mov r0, r2
172 ; CHECK-T2NODSP-NEXT: pop {r7, pc}
275173 ;
276 ; CHECK-ARM6-LABEL: qdsub_c:
277 ; CHECK-ARM6: @ %bb.0:
278 ; CHECK-ARM6-NEXT: .save {r11, lr}
279 ; CHECK-ARM6-NEXT: push {r11, lr}
280 ; CHECK-ARM6-NEXT: adds r12, r0, r0
281 ; CHECK-ARM6-NEXT: mov r3, #0
282 ; CHECK-ARM6-NEXT: movmi r3, #1
283 ; CHECK-ARM6-NEXT: cmp r3, #0
284 ; CHECK-ARM6-NEXT: mov r3, #-2147483648
285 ; CHECK-ARM6-NEXT: mov lr, #0
286 ; CHECK-ARM6-NEXT: mvnne r3, #-2147483648
287 ; CHECK-ARM6-NEXT: cmp r12, r0
288 ; CHECK-ARM6-NEXT: movvc r3, r12
289 ; CHECK-ARM6-NEXT: subs r0, r3, r1
290 ; CHECK-ARM6-NEXT: movmi lr, #1
291 ; CHECK-ARM6-NEXT: mov r2, #-2147483648
292 ; CHECK-ARM6-NEXT: cmp lr, #0
293 ; CHECK-ARM6-NEXT: mvnne r2, #-2147483648
294 ; CHECK-ARM6-NEXT: cmp r3, r1
295 ; CHECK-ARM6-NEXT: movvc r2, r0
296 ; CHECK-ARM6-NEXT: mov r0, r2
297 ; CHECK-ARM6-NEXT: pop {r11, pc}
174 ; CHECK-T2DSP-LABEL: qdsub_c:
175 ; CHECK-T2DSP: @ %bb.0:
176 ; CHECK-T2DSP-NEXT: qadd r0, r0, r0
177 ; CHECK-T2DSP-NEXT: qsub r0, r0, r1
178 ; CHECK-T2DSP-NEXT: bx lr
298179 ;
299 ; CHECK-ARM8-LABEL: qdsub_c:
300 ; CHECK-ARM8: @ %bb.0:
301 ; CHECK-ARM8-NEXT: .save {r11, lr}
302 ; CHECK-ARM8-NEXT: push {r11, lr}
303 ; CHECK-ARM8-NEXT: adds r12, r0, r0
304 ; CHECK-ARM8-NEXT: mov r3, #0
305 ; CHECK-ARM8-NEXT: movwmi r3, #1
306 ; CHECK-ARM8-NEXT: cmp r3, #0
307 ; CHECK-ARM8-NEXT: mov r3, #-2147483648
308 ; CHECK-ARM8-NEXT: mov lr, #0
309 ; CHECK-ARM8-NEXT: mvnne r3, #-2147483648
310 ; CHECK-ARM8-NEXT: cmp r12, r0
311 ; CHECK-ARM8-NEXT: movvc r3, r12
312 ; CHECK-ARM8-NEXT: subs r0, r3, r1
313 ; CHECK-ARM8-NEXT: movwmi lr, #1
314 ; CHECK-ARM8-NEXT: mov r2, #-2147483648
315 ; CHECK-ARM8-NEXT: cmp lr, #0
316 ; CHECK-ARM8-NEXT: mvnne r2, #-2147483648
317 ; CHECK-ARM8-NEXT: cmp r3, r1
318 ; CHECK-ARM8-NEXT: movvc r2, r0
319 ; CHECK-ARM8-NEXT: mov r0, r2
320 ; CHECK-ARM8-NEXT: pop {r11, pc}
180 ; CHECK-ARM-LABEL: qdsub_c:
181 ; CHECK-ARM: @ %bb.0:
182 ; CHECK-ARM-NEXT: qadd r0, r0, r0
183 ; CHECK-ARM-NEXT: qsub r0, r0, r1
184 ; CHECK-ARM-NEXT: bx lr
321185 %z = call i32 @llvm.sadd.sat.i32(i32 %x, i32 %x)
322186 %tmp = call i32 @llvm.ssub.sat.i32(i32 %z, i32 %y)
323187 ret i32 %tmp
4242 ; CHECK-T1-NEXT: .LCPI0_0:
4343 ; CHECK-T1-NEXT: .long 2147483647 @ 0x7fffffff
4444 ;
45 ; CHECK-T2-LABEL: func:
46 ; CHECK-T2: @ %bb.0:
47 ; CHECK-T2-NEXT: adds r2, r0, r1
48 ; CHECK-T2-NEXT: mov.w r3, #0
49 ; CHECK-T2-NEXT: mov.w r1, #-2147483648
50 ; CHECK-T2-NEXT: it mi
51 ; CHECK-T2-NEXT: movmi r3, #1
52 ; CHECK-T2-NEXT: cmp r3, #0
53 ; CHECK-T2-NEXT: it ne
54 ; CHECK-T2-NEXT: mvnne r1, #-2147483648
55 ; CHECK-T2-NEXT: cmp r2, r0
56 ; CHECK-T2-NEXT: it vc
57 ; CHECK-T2-NEXT: movvc r1, r2
58 ; CHECK-T2-NEXT: mov r0, r1
59 ; CHECK-T2-NEXT: bx lr
60 ;
61 ; CHECK-ARM-LABEL: func:
62 ; CHECK-ARM: @ %bb.0:
63 ; CHECK-ARM-NEXT: adds r2, r0, r1
64 ; CHECK-ARM-NEXT: mov r3, #0
65 ; CHECK-ARM-NEXT: movmi r3, #1
66 ; CHECK-ARM-NEXT: mov r1, #-2147483648
67 ; CHECK-ARM-NEXT: cmp r3, #0
68 ; CHECK-ARM-NEXT: mvnne r1, #-2147483648
69 ; CHECK-ARM-NEXT: cmp r2, r0
70 ; CHECK-ARM-NEXT: movvc r1, r2
71 ; CHECK-ARM-NEXT: mov r0, r1
72 ; CHECK-ARM-NEXT: bx lr
45 ; CHECK-T2NODSP-LABEL: func:
46 ; CHECK-T2NODSP: @ %bb.0:
47 ; CHECK-T2NODSP-NEXT: adds r2, r0, r1
48 ; CHECK-T2NODSP-NEXT: mov.w r3, #0
49 ; CHECK-T2NODSP-NEXT: mov.w r1, #-2147483648
50 ; CHECK-T2NODSP-NEXT: it mi
51 ; CHECK-T2NODSP-NEXT: movmi r3, #1
52 ; CHECK-T2NODSP-NEXT: cmp r3, #0
53 ; CHECK-T2NODSP-NEXT: it ne
54 ; CHECK-T2NODSP-NEXT: mvnne r1, #-2147483648
55 ; CHECK-T2NODSP-NEXT: cmp r2, r0
56 ; CHECK-T2NODSP-NEXT: it vc
57 ; CHECK-T2NODSP-NEXT: movvc r1, r2
58 ; CHECK-T2NODSP-NEXT: mov r0, r1
59 ; CHECK-T2NODSP-NEXT: bx lr
60 ;
61 ; CHECK-T2DSP-LABEL: func:
62 ; CHECK-T2DSP: @ %bb.0:
63 ; CHECK-T2DSP-NEXT: qadd r0, r0, r1
64 ; CHECK-T2DSP-NEXT: bx lr
65 ;
66 ; CHECK-ARMNODPS-LABEL: func:
67 ; CHECK-ARMNODPS: @ %bb.0:
68 ; CHECK-ARMNODPS-NEXT: adds r2, r0, r1
69 ; CHECK-ARMNODPS-NEXT: mov r3, #0
70 ; CHECK-ARMNODPS-NEXT: movmi r3, #1
71 ; CHECK-ARMNODPS-NEXT: mov r1, #-2147483648
72 ; CHECK-ARMNODPS-NEXT: cmp r3, #0
73 ; CHECK-ARMNODPS-NEXT: mvnne r1, #-2147483648
74 ; CHECK-ARMNODPS-NEXT: cmp r2, r0
75 ; CHECK-ARMNODPS-NEXT: movvc r1, r2
76 ; CHECK-ARMNODPS-NEXT: mov r0, r1
77 ; CHECK-ARMNODPS-NEXT: bx lr
78 ;
79 ; CHECK-ARMBASEDSP-LABEL: func:
80 ; CHECK-ARMBASEDSP: @ %bb.0:
81 ; CHECK-ARMBASEDSP-NEXT: qadd r0, r0, r1
82 ; CHECK-ARMBASEDSP-NEXT: bx lr
83 ;
84 ; CHECK-ARMDSP-LABEL: func:
85 ; CHECK-ARMDSP: @ %bb.0:
86 ; CHECK-ARMDSP-NEXT: qadd r0, r0, r1
87 ; CHECK-ARMDSP-NEXT: bx lr
7388 %tmp = call i32 @llvm.sadd.sat.i32(i32 %x, i32 %y)
7489 ret i32 %tmp
7590 }
270285 ;
271286 ; CHECK-ARMBASEDSP-LABEL: func16:
272287 ; CHECK-ARMBASEDSP: @ %bb.0:
273 ; CHECK-ARMBASEDSP-NEXT: add r0, r0, r1
274 ; CHECK-ARMBASEDSP-NEXT: mov r1, #255
275 ; CHECK-ARMBASEDSP-NEXT: orr r1, r1, #32512
276 ; CHECK-ARMBASEDSP-NEXT: cmp r0, r1
277 ; CHECK-ARMBASEDSP-NEXT: movlt r1, r0
278 ; CHECK-ARMBASEDSP-NEXT: ldr r0, .LCPI2_0
279 ; CHECK-ARMBASEDSP-NEXT: cmn r1, #32768
280 ; CHECK-ARMBASEDSP-NEXT: movgt r0, r1
288 ; CHECK-ARMBASEDSP-NEXT: lsl r0, r0, #16
289 ; CHECK-ARMBASEDSP-NEXT: lsl r1, r1, #16
290 ; CHECK-ARMBASEDSP-NEXT: qadd r0, r0, r1
291 ; CHECK-ARMBASEDSP-NEXT: asr r0, r0, #16
281292 ; CHECK-ARMBASEDSP-NEXT: bx lr
282 ; CHECK-ARMBASEDSP-NEXT: .p2align 2
283 ; CHECK-ARMBASEDSP-NEXT: @ %bb.1:
284 ; CHECK-ARMBASEDSP-NEXT: .LCPI2_0:
285 ; CHECK-ARMBASEDSP-NEXT: .long 4294934528 @ 0xffff8000
286293 ;
287294 ; CHECK-ARMDSP-LABEL: func16:
288295 ; CHECK-ARMDSP: @ %bb.0:
339346 ;
340347 ; CHECK-ARMBASEDSP-LABEL: func8:
341348 ; CHECK-ARMBASEDSP: @ %bb.0:
342 ; CHECK-ARMBASEDSP-NEXT: add r0, r0, r1
343 ; CHECK-ARMBASEDSP-NEXT: cmp r0, #127
344 ; CHECK-ARMBASEDSP-NEXT: movge r0, #127
345 ; CHECK-ARMBASEDSP-NEXT: cmn r0, #128
346 ; CHECK-ARMBASEDSP-NEXT: mvnle r0, #127
349 ; CHECK-ARMBASEDSP-NEXT: lsl r0, r0, #24
350 ; CHECK-ARMBASEDSP-NEXT: lsl r1, r1, #24
351 ; CHECK-ARMBASEDSP-NEXT: qadd r0, r0, r1
352 ; CHECK-ARMBASEDSP-NEXT: asr r0, r0, #24
347353 ; CHECK-ARMBASEDSP-NEXT: bx lr
348354 ;
349355 ; CHECK-ARMDSP-LABEL: func8:
373379 ; CHECK-T1-NEXT: .LBB4_4:
374380 ; CHECK-T1-NEXT: bx lr
375381 ;
376 ; CHECK-T2-LABEL: func3:
377 ; CHECK-T2: @ %bb.0:
378 ; CHECK-T2-NEXT: add r0, r1
379 ; CHECK-T2-NEXT: cmp r0, #7
380 ; CHECK-T2-NEXT: it ge
381 ; CHECK-T2-NEXT: movge r0, #7
382 ; CHECK-T2-NEXT: cmn.w r0, #8
383 ; CHECK-T2-NEXT: it le
384 ; CHECK-T2-NEXT: mvnle r0, #7
385 ; CHECK-T2-NEXT: bx lr
386 ;
387 ; CHECK-ARM-LABEL: func3:
388 ; CHECK-ARM: @ %bb.0:
389 ; CHECK-ARM-NEXT: add r0, r0, r1
390 ; CHECK-ARM-NEXT: cmp r0, #7
391 ; CHECK-ARM-NEXT: movge r0, #7
392 ; CHECK-ARM-NEXT: cmn r0, #8
393 ; CHECK-ARM-NEXT: mvnle r0, #7
394 ; CHECK-ARM-NEXT: bx lr
382 ; CHECK-T2NODSP-LABEL: func3:
383 ; CHECK-T2NODSP: @ %bb.0:
384 ; CHECK-T2NODSP-NEXT: add r0, r1
385 ; CHECK-T2NODSP-NEXT: cmp r0, #7
386 ; CHECK-T2NODSP-NEXT: it ge
387 ; CHECK-T2NODSP-NEXT: movge r0, #7
388 ; CHECK-T2NODSP-NEXT: cmn.w r0, #8
389 ; CHECK-T2NODSP-NEXT: it le
390 ; CHECK-T2NODSP-NEXT: mvnle r0, #7
391 ; CHECK-T2NODSP-NEXT: bx lr
392 ;
393 ; CHECK-T2DSP-LABEL: func3:
394 ; CHECK-T2DSP: @ %bb.0:
395 ; CHECK-T2DSP-NEXT: lsls r1, r1, #28
396 ; CHECK-T2DSP-NEXT: lsls r0, r0, #28
397 ; CHECK-T2DSP-NEXT: qadd r0, r0, r1
398 ; CHECK-T2DSP-NEXT: asrs r0, r0, #28
399 ; CHECK-T2DSP-NEXT: bx lr
400 ;
401 ; CHECK-ARMNODPS-LABEL: func3:
402 ; CHECK-ARMNODPS: @ %bb.0:
403 ; CHECK-ARMNODPS-NEXT: add r0, r0, r1
404 ; CHECK-ARMNODPS-NEXT: cmp r0, #7
405 ; CHECK-ARMNODPS-NEXT: movge r0, #7
406 ; CHECK-ARMNODPS-NEXT: cmn r0, #8
407 ; CHECK-ARMNODPS-NEXT: mvnle r0, #7
408 ; CHECK-ARMNODPS-NEXT: bx lr
409 ;
410 ; CHECK-ARMBASEDSP-LABEL: func3:
411 ; CHECK-ARMBASEDSP: @ %bb.0:
412 ; CHECK-ARMBASEDSP-NEXT: lsl r0, r0, #28
413 ; CHECK-ARMBASEDSP-NEXT: lsl r1, r1, #28
414 ; CHECK-ARMBASEDSP-NEXT: qadd r0, r0, r1
415 ; CHECK-ARMBASEDSP-NEXT: asr r0, r0, #28
416 ; CHECK-ARMBASEDSP-NEXT: bx lr
417 ;
418 ; CHECK-ARMDSP-LABEL: func3:
419 ; CHECK-ARMDSP: @ %bb.0:
420 ; CHECK-ARMDSP-NEXT: lsl r0, r0, #28
421 ; CHECK-ARMDSP-NEXT: lsl r1, r1, #28
422 ; CHECK-ARMDSP-NEXT: qadd r0, r0, r1
423 ; CHECK-ARMDSP-NEXT: asr r0, r0, #28
424 ; CHECK-ARMDSP-NEXT: bx lr
395425 %tmp = call i4 @llvm.sadd.sat.i4(i4 %x, i4 %y)
396426 ret i4 %tmp
397427 }
4141 ; CHECK-T1-NEXT: .LCPI0_0:
4242 ; CHECK-T1-NEXT: .long 2147483647 @ 0x7fffffff
4343 ;
44 ; CHECK-T2-LABEL: func32:
45 ; CHECK-T2: @ %bb.0:
46 ; CHECK-T2-NEXT: mla r2, r1, r2, r0
47 ; CHECK-T2-NEXT: movs r3, #0
48 ; CHECK-T2-NEXT: mov.w r1, #-2147483648
49 ; CHECK-T2-NEXT: cmp r2, #0
50 ; CHECK-T2-NEXT: it mi
51 ; CHECK-T2-NEXT: movmi r3, #1
52 ; CHECK-T2-NEXT: cmp r3, #0
53 ; CHECK-T2-NEXT: it ne
54 ; CHECK-T2-NEXT: mvnne r1, #-2147483648
55 ; CHECK-T2-NEXT: cmp r2, r0
56 ; CHECK-T2-NEXT: it vc
57 ; CHECK-T2-NEXT: movvc r1, r2
58 ; CHECK-T2-NEXT: mov r0, r1
59 ; CHECK-T2-NEXT: bx lr
44 ; CHECK-T2NODSP-LABEL: func32:
45 ; CHECK-T2NODSP: @ %bb.0:
46 ; CHECK-T2NODSP-NEXT: mla r2, r1, r2, r0
47 ; CHECK-T2NODSP-NEXT: movs r3, #0
48 ; CHECK-T2NODSP-NEXT: mov.w r1, #-2147483648
49 ; CHECK-T2NODSP-NEXT: cmp r2, #0
50 ; CHECK-T2NODSP-NEXT: it mi
51 ; CHECK-T2NODSP-NEXT: movmi r3, #1
52 ; CHECK-T2NODSP-NEXT: cmp r3, #0
53 ; CHECK-T2NODSP-NEXT: it ne
54 ; CHECK-T2NODSP-NEXT: mvnne r1, #-2147483648
55 ; CHECK-T2NODSP-NEXT: cmp r2, r0
56 ; CHECK-T2NODSP-NEXT: it vc
57 ; CHECK-T2NODSP-NEXT: movvc r1, r2
58 ; CHECK-T2NODSP-NEXT: mov r0, r1
59 ; CHECK-T2NODSP-NEXT: bx lr
60 ;
61 ; CHECK-T2DSP-LABEL: func32:
62 ; CHECK-T2DSP: @ %bb.0:
63 ; CHECK-T2DSP-NEXT: muls r1, r2, r1
64 ; CHECK-T2DSP-NEXT: qadd r0, r0, r1
65 ; CHECK-T2DSP-NEXT: bx lr
6066 ;
6167 ; CHECK-ARM-LABEL: func32:
6268 ; CHECK-ARM: @ %bb.0:
63 ; CHECK-ARM-NEXT: mla r2, r1, r2, r0
64 ; CHECK-ARM-NEXT: mov r3, #0
65 ; CHECK-ARM-NEXT: mov r1, #-2147483648
66 ; CHECK-ARM-NEXT: cmp r2, #0
67 ; CHECK-ARM-NEXT: movwmi r3, #1
68 ; CHECK-ARM-NEXT: cmp r3, #0
69 ; CHECK-ARM-NEXT: mvnne r1, #-2147483648
70 ; CHECK-ARM-NEXT: cmp r2, r0
71 ; CHECK-ARM-NEXT: movvc r1, r2
72 ; CHECK-ARM-NEXT: mov r0, r1
69 ; CHECK-ARM-NEXT: mul r1, r1, r2
70 ; CHECK-ARM-NEXT: qadd r0, r0, r1
7371 ; CHECK-ARM-NEXT: bx lr
7472 %a = mul i32 %y, %z
7573 %tmp = call i32 @llvm.sadd.sat.i32(i32 %x, i32 %a)
344342 ; CHECK-T1-NEXT: .LBB4_4:
345343 ; CHECK-T1-NEXT: bx lr
346344 ;
347 ; CHECK-T2-LABEL: func4:
348 ; CHECK-T2: @ %bb.0:
349 ; CHECK-T2-NEXT: muls r1, r2, r1
350 ; CHECK-T2-NEXT: lsls r1, r1, #28
351 ; CHECK-T2-NEXT: add.w r0, r0, r1, asr #28
352 ; CHECK-T2-NEXT: cmp r0, #7
353 ; CHECK-T2-NEXT: it ge
354 ; CHECK-T2-NEXT: movge r0, #7
355 ; CHECK-T2-NEXT: cmn.w r0, #8
356 ; CHECK-T2-NEXT: it le
357 ; CHECK-T2-NEXT: mvnle r0, #7
358 ; CHECK-T2-NEXT: bx lr
345 ; CHECK-T2NODSP-LABEL: func4:
346 ; CHECK-T2NODSP: @ %bb.0:
347 ; CHECK-T2NODSP-NEXT: muls r1, r2, r1
348 ; CHECK-T2NODSP-NEXT: lsls r1, r1, #28
349 ; CHECK-T2NODSP-NEXT: add.w r0, r0, r1, asr #28
350 ; CHECK-T2NODSP-NEXT: cmp r0, #7
351 ; CHECK-T2NODSP-NEXT: it ge
352 ; CHECK-T2NODSP-NEXT: movge r0, #7
353 ; CHECK-T2NODSP-NEXT: cmn.w r0, #8
354 ; CHECK-T2NODSP-NEXT: it le
355 ; CHECK-T2NODSP-NEXT: mvnle r0, #7
356 ; CHECK-T2NODSP-NEXT: bx lr
357 ;
358 ; CHECK-T2DSP-LABEL: func4:
359 ; CHECK-T2DSP: @ %bb.0:
360 ; CHECK-T2DSP-NEXT: muls r1, r2, r1
361 ; CHECK-T2DSP-NEXT: lsls r0, r0, #28
362 ; CHECK-T2DSP-NEXT: lsls r1, r1, #28
363 ; CHECK-T2DSP-NEXT: qadd r0, r0, r1
364 ; CHECK-T2DSP-NEXT: asrs r0, r0, #28
365 ; CHECK-T2DSP-NEXT: bx lr
359366 ;
360367 ; CHECK-ARM-LABEL: func4:
361368 ; CHECK-ARM: @ %bb.0:
362369 ; CHECK-ARM-NEXT: smulbb r1, r1, r2
370 ; CHECK-ARM-NEXT: lsl r0, r0, #28
363371 ; CHECK-ARM-NEXT: lsl r1, r1, #28
364 ; CHECK-ARM-NEXT: add r0, r0, r1, asr #28
365 ; CHECK-ARM-NEXT: cmp r0, #7
366 ; CHECK-ARM-NEXT: movge r0, #7
367 ; CHECK-ARM-NEXT: cmn r0, #8
368 ; CHECK-ARM-NEXT: mvnle r0, #7
372 ; CHECK-ARM-NEXT: qadd r0, r0, r1
373 ; CHECK-ARM-NEXT: asr r0, r0, #28
369374 ; CHECK-ARM-NEXT: bx lr
370375 %a = mul i4 %y, %z
371376 %tmp = call i4 @llvm.sadd.sat.i4(i4 %x, i4 %a)
4545 ; CHECK-T1-NEXT: .LCPI0_0:
4646 ; CHECK-T1-NEXT: .long 2147483647 @ 0x7fffffff
4747 ;
48 ; CHECK-T2-LABEL: func:
49 ; CHECK-T2: @ %bb.0:
50 ; CHECK-T2-NEXT: subs.w r12, r0, r1
51 ; CHECK-T2-NEXT: mov.w r3, #0
52 ; CHECK-T2-NEXT: mov.w r2, #-2147483648
53 ; CHECK-T2-NEXT: it mi
54 ; CHECK-T2-NEXT: movmi r3, #1
55 ; CHECK-T2-NEXT: cmp r3, #0
56 ; CHECK-T2-NEXT: it ne
57 ; CHECK-T2-NEXT: mvnne r2, #-2147483648
58 ; CHECK-T2-NEXT: cmp r0, r1
59 ; CHECK-T2-NEXT: it vc
60 ; CHECK-T2-NEXT: movvc r2, r12
61 ; CHECK-T2-NEXT: mov r0, r2
62 ; CHECK-T2-NEXT: bx lr
63 ;
64 ; CHECK-ARM-LABEL: func:
65 ; CHECK-ARM: @ %bb.0:
66 ; CHECK-ARM-NEXT: subs r12, r0, r1
67 ; CHECK-ARM-NEXT: mov r3, #0
68 ; CHECK-ARM-NEXT: movmi r3, #1
69 ; CHECK-ARM-NEXT: mov r2, #-2147483648
70 ; CHECK-ARM-NEXT: cmp r3, #0
71 ; CHECK-ARM-NEXT: mvnne r2, #-2147483648
72 ; CHECK-ARM-NEXT: cmp r0, r1
73 ; CHECK-ARM-NEXT: movvc r2, r12
74 ; CHECK-ARM-NEXT: mov r0, r2
75 ; CHECK-ARM-NEXT: bx lr
48 ; CHECK-T2NODSP-LABEL: func:
49 ; CHECK-T2NODSP: @ %bb.0:
50 ; CHECK-T2NODSP-NEXT: subs.w r12, r0, r1
51 ; CHECK-T2NODSP-NEXT: mov.w r3, #0
52 ; CHECK-T2NODSP-NEXT: mov.w r2, #-2147483648
53 ; CHECK-T2NODSP-NEXT: it mi
54 ; CHECK-T2NODSP-NEXT: movmi r3, #1
55 ; CHECK-T2NODSP-NEXT: cmp r3, #0
56 ; CHECK-T2NODSP-NEXT: it ne
57 ; CHECK-T2NODSP-NEXT: mvnne r2, #-2147483648
58 ; CHECK-T2NODSP-NEXT: cmp r0, r1
59 ; CHECK-T2NODSP-NEXT: it vc
60 ; CHECK-T2NODSP-NEXT: movvc r2, r12
61 ; CHECK-T2NODSP-NEXT: mov r0, r2
62 ; CHECK-T2NODSP-NEXT: bx lr
63 ;
64 ; CHECK-T2DSP-LABEL: func:
65 ; CHECK-T2DSP: @ %bb.0:
66 ; CHECK-T2DSP-NEXT: qsub r0, r0, r1
67 ; CHECK-T2DSP-NEXT: bx lr
68 ;
69 ; CHECK-ARMNODPS-LABEL: func:
70 ; CHECK-ARMNODPS: @ %bb.0:
71 ; CHECK-ARMNODPS-NEXT: subs r12, r0, r1
72 ; CHECK-ARMNODPS-NEXT: mov r3, #0
73 ; CHECK-ARMNODPS-NEXT: movmi r3, #1
74 ; CHECK-ARMNODPS-NEXT: mov r2, #-2147483648
75 ; CHECK-ARMNODPS-NEXT: cmp r3, #0
76 ; CHECK-ARMNODPS-NEXT: mvnne r2, #-2147483648
77 ; CHECK-ARMNODPS-NEXT: cmp r0, r1
78 ; CHECK-ARMNODPS-NEXT: movvc r2, r12
79 ; CHECK-ARMNODPS-NEXT: mov r0, r2
80 ; CHECK-ARMNODPS-NEXT: bx lr
81 ;
82 ; CHECK-ARMBASEDSP-LABEL: func:
83 ; CHECK-ARMBASEDSP: @ %bb.0:
84 ; CHECK-ARMBASEDSP-NEXT: qsub r0, r0, r1
85 ; CHECK-ARMBASEDSP-NEXT: bx lr
86 ;
87 ; CHECK-ARMDSP-LABEL: func:
88 ; CHECK-ARMDSP: @ %bb.0:
89 ; CHECK-ARMDSP-NEXT: qsub r0, r0, r1
90 ; CHECK-ARMDSP-NEXT: bx lr
7691 %tmp = call i32 @llvm.ssub.sat.i32(i32 %x, i32 %y)
7792 ret i32 %tmp
7893 }
272287 ;
273288 ; CHECK-ARMBASEDSP-LABEL: func16:
274289 ; CHECK-ARMBASEDSP: @ %bb.0:
275 ; CHECK-ARMBASEDSP-NEXT: sub r0, r0, r1
276 ; CHECK-ARMBASEDSP-NEXT: mov r1, #255
277 ; CHECK-ARMBASEDSP-NEXT: orr r1, r1, #32512
278 ; CHECK-ARMBASEDSP-NEXT: cmp r0, r1
279 ; CHECK-ARMBASEDSP-NEXT: movlt r1, r0
280 ; CHECK-ARMBASEDSP-NEXT: ldr r0, .LCPI2_0
281 ; CHECK-ARMBASEDSP-NEXT: cmn r1, #32768
282 ; CHECK-ARMBASEDSP-NEXT: movgt r0, r1
290 ; CHECK-ARMBASEDSP-NEXT: lsl r0, r0, #16
291 ; CHECK-ARMBASEDSP-NEXT: lsl r1, r1, #16
292 ; CHECK-ARMBASEDSP-NEXT: qsub r0, r0, r1
293 ; CHECK-ARMBASEDSP-NEXT: asr r0, r0, #16
283294 ; CHECK-ARMBASEDSP-NEXT: bx lr
284 ; CHECK-ARMBASEDSP-NEXT: .p2align 2
285 ; CHECK-ARMBASEDSP-NEXT: @ %bb.1:
286 ; CHECK-ARMBASEDSP-NEXT: .LCPI2_0:
287 ; CHECK-ARMBASEDSP-NEXT: .long 4294934528 @ 0xffff8000
288295 ;
289296 ; CHECK-ARMDSP-LABEL: func16:
290297 ; CHECK-ARMDSP: @ %bb.0:
341348 ;
342349 ; CHECK-ARMBASEDSP-LABEL: func8:
343350 ; CHECK-ARMBASEDSP: @ %bb.0:
344 ; CHECK-ARMBASEDSP-NEXT: sub r0, r0, r1
345 ; CHECK-ARMBASEDSP-NEXT: cmp r0, #127
346 ; CHECK-ARMBASEDSP-NEXT: movge r0, #127
347 ; CHECK-ARMBASEDSP-NEXT: cmn r0, #128
348 ; CHECK-ARMBASEDSP-NEXT: mvnle r0, #127
351 ; CHECK-ARMBASEDSP-NEXT: lsl r0, r0, #24
352 ; CHECK-ARMBASEDSP-NEXT: lsl r1, r1, #24
353 ; CHECK-ARMBASEDSP-NEXT: qsub r0, r0, r1
354 ; CHECK-ARMBASEDSP-NEXT: asr r0, r0, #24
349355 ; CHECK-ARMBASEDSP-NEXT: bx lr
350356 ;
351357 ; CHECK-ARMDSP-LABEL: func8:
375381 ; CHECK-T1-NEXT: .LBB4_4:
376382 ; CHECK-T1-NEXT: bx lr
377383 ;
378 ; CHECK-T2-LABEL: func3:
379 ; CHECK-T2: @ %bb.0:
380 ; CHECK-T2-NEXT: subs r0, r0, r1
381 ; CHECK-T2-NEXT: cmp r0, #7
382 ; CHECK-T2-NEXT: it ge
383 ; CHECK-T2-NEXT: movge r0, #7
384 ; CHECK-T2-NEXT: cmn.w r0, #8
385 ; CHECK-T2-NEXT: it le
386 ; CHECK-T2-NEXT: mvnle r0, #7
387 ; CHECK-T2-NEXT: bx lr
388 ;
389 ; CHECK-ARM-LABEL: func3:
390 ; CHECK-ARM: @ %bb.0:
391 ; CHECK-ARM-NEXT: sub r0, r0, r1
392 ; CHECK-ARM-NEXT: cmp r0, #7
393 ; CHECK-ARM-NEXT: movge r0, #7
394 ; CHECK-ARM-NEXT: cmn r0, #8
395 ; CHECK-ARM-NEXT: mvnle r0, #7
396 ; CHECK-ARM-NEXT: bx lr
384 ; CHECK-T2NODSP-LABEL: func3:
385 ; CHECK-T2NODSP: @ %bb.0:
386 ; CHECK-T2NODSP-NEXT: subs r0, r0, r1
387 ; CHECK-T2NODSP-NEXT: cmp r0, #7
388 ; CHECK-T2NODSP-NEXT: it ge
389 ; CHECK-T2NODSP-NEXT: movge r0, #7
390 ; CHECK-T2NODSP-NEXT: cmn.w r0, #8
391 ; CHECK-T2NODSP-NEXT: it le
392 ; CHECK-T2NODSP-NEXT: mvnle r0, #7
393 ; CHECK-T2NODSP-NEXT: bx lr
394 ;
395 ; CHECK-T2DSP-LABEL: func3:
396 ; CHECK-T2DSP: @ %bb.0:
397 ; CHECK-T2DSP-NEXT: lsls r1, r1, #28
398 ; CHECK-T2DSP-NEXT: lsls r0, r0, #28
399 ; CHECK-T2DSP-NEXT: qsub r0, r0, r1
400 ; CHECK-T2DSP-NEXT: asrs r0, r0, #28
401 ; CHECK-T2DSP-NEXT: bx lr
402 ;
403 ; CHECK-ARMNODPS-LABEL: func3:
404 ; CHECK-ARMNODPS: @ %bb.0:
405 ; CHECK-ARMNODPS-NEXT: sub r0, r0, r1
406 ; CHECK-ARMNODPS-NEXT: cmp r0, #7
407 ; CHECK-ARMNODPS-NEXT: movge r0, #7
408 ; CHECK-ARMNODPS-NEXT: cmn r0, #8
409 ; CHECK-ARMNODPS-NEXT: mvnle r0, #7
410 ; CHECK-ARMNODPS-NEXT: bx lr
411 ;
412 ; CHECK-ARMBASEDSP-LABEL: func3:
413 ; CHECK-ARMBASEDSP: @ %bb.0:
414 ; CHECK-ARMBASEDSP-NEXT: lsl r0, r0, #28
415 ; CHECK-ARMBASEDSP-NEXT: lsl r1, r1, #28
416 ; CHECK-ARMBASEDSP-NEXT: qsub r0, r0, r1
417 ; CHECK-ARMBASEDSP-NEXT: asr r0, r0, #28
418 ; CHECK-ARMBASEDSP-NEXT: bx lr
419 ;
420 ; CHECK-ARMDSP-LABEL: func3:
421 ; CHECK-ARMDSP: @ %bb.0:
422 ; CHECK-ARMDSP-NEXT: lsl r0, r0, #28
423 ; CHECK-ARMDSP-NEXT: lsl r1, r1, #28
424 ; CHECK-ARMDSP-NEXT: qsub r0, r0, r1
425 ; CHECK-ARMDSP-NEXT: asr r0, r0, #28
426 ; CHECK-ARMDSP-NEXT: bx lr
397427 %tmp = call i4 @llvm.ssub.sat.i4(i4 %x, i4 %y)
398428 ret i4 %tmp
399429 }
500530 ; CHECK-T1-NEXT: .LCPI5_0:
501531 ; CHECK-T1-NEXT: .long 2147483647 @ 0x7fffffff
502532 ;
503 ; CHECK-T2-LABEL: vec:
504 ; CHECK-T2: @ %bb.0:
505 ; CHECK-T2-NEXT: .save {r4, r5, r6, r7, lr}
506 ; CHECK-T2-NEXT: push {r4, r5, r6, r7, lr}
507 ; CHECK-T2-NEXT: .pad #4
508 ; CHECK-T2-NEXT: sub sp, #4
509 ; CHECK-T2-NEXT: ldr r4, [sp, #24]
510 ; CHECK-T2-NEXT: mov lr, r0
511 ; CHECK-T2-NEXT: ldr r7, [sp, #28]
512 ; CHECK-T2-NEXT: movs r5, #0
513 ; CHECK-T2-NEXT: subs r6, r0, r4
514 ; CHECK-T2-NEXT: mov.w r0, #0
515 ; CHECK-T2-NEXT: it mi
516 ; CHECK-T2-NEXT: movmi r0, #1
517 ; CHECK-T2-NEXT: cmp r0, #0
518 ; CHECK-T2-NEXT: mov.w r0, #-2147483648
519 ; CHECK-T2-NEXT: mov.w r12, #-2147483648
520 ; CHECK-T2-NEXT: it ne
521 ; CHECK-T2-NEXT: mvnne r0, #-2147483648
522 ; CHECK-T2-NEXT: cmp lr, r4
523 ; CHECK-T2-NEXT: it vc
524 ; CHECK-T2-NEXT: movvc r0, r6
525 ; CHECK-T2-NEXT: subs r6, r1, r7
526 ; CHECK-T2-NEXT: mov.w r4, #0
527 ; CHECK-T2-NEXT: mov.w lr, #-2147483648
528 ; CHECK-T2-NEXT: it mi
529 ; CHECK-T2-NEXT: movmi r4, #1
530 ; CHECK-T2-NEXT: cmp r4, #0
531 ; CHECK-T2-NEXT: it ne
532 ; CHECK-T2-NEXT: mvnne lr, #-2147483648
533 ; CHECK-T2-NEXT: cmp r1, r7
534 ; CHECK-T2-NEXT: ldr r1, [sp, #32]
535 ; CHECK-T2-NEXT: mov.w r4, #0
536 ; CHECK-T2-NEXT: it vc
537 ; CHECK-T2-NEXT: movvc lr, r6
538 ; CHECK-T2-NEXT: subs r6, r2, r1
539 ; CHECK-T2-NEXT: it mi
540 ; CHECK-T2-NEXT: movmi r4, #1
541 ; CHECK-T2-NEXT: cmp r4, #0
542 ; CHECK-T2-NEXT: mov.w r4, #-2147483648
543 ; CHECK-T2-NEXT: it ne
544 ; CHECK-T2-NEXT: mvnne r4, #-2147483648
545 ; CHECK-T2-NEXT: cmp r2, r1
546 ; CHECK-T2-NEXT: ldr r1, [sp, #36]
547 ; CHECK-T2-NEXT: it vc
548 ; CHECK-T2-NEXT: movvc r4, r6
549 ; CHECK-T2-NEXT: subs r2, r3, r1
550 ; CHECK-T2-NEXT: it mi
551 ; CHECK-T2-NEXT: movmi r5, #1
552 ; CHECK-T2-NEXT: cmp r5, #0
553 ; CHECK-T2-NEXT: it ne
554 ; CHECK-T2-NEXT: mvnne r12, #-2147483648
555 ; CHECK-T2-NEXT: cmp r3, r1
556 ; CHECK-T2-NEXT: it vc
557 ; CHECK-T2-NEXT: movvc r12, r2
558 ; CHECK-T2-NEXT: mov r1, lr
559 ; CHECK-T2-NEXT: mov r2, r4
560 ; CHECK-T2-NEXT: mov r3, r12
561 ; CHECK-T2-NEXT: add sp, #4
562 ; CHECK-T2-NEXT: pop {r4, r5, r6, r7, pc}
563 ;
564 ; CHECK-ARM-LABEL: vec:
565 ; CHECK-ARM: @ %bb.0:
566 ; CHECK-ARM-NEXT: .save {r4, r5, r6, r7, r11, lr}
567 ; CHECK-ARM-NEXT: push {r4, r5, r6, r7, r11, lr}
568 ; CHECK-ARM-NEXT: ldr r4, [sp, #24]
569 ; CHECK-ARM-NEXT: mov lr, r0
570 ; CHECK-ARM-NEXT: ldr r7, [sp, #28]
571 ; CHECK-ARM-NEXT: mov r5, #0
572 ; CHECK-ARM-NEXT: subs r6, r0, r4
573 ; CHECK-ARM-NEXT: mov r0, #0
574 ; CHECK-ARM-NEXT: movmi r0, #1
575 ; CHECK-ARM-NEXT: cmp r0, #0
576 ; CHECK-ARM-NEXT: mov r0, #-2147483648
577 ; CHECK-ARM-NEXT: mov r12, #-2147483648
578 ; CHECK-ARM-NEXT: mvnne r0, #-2147483648
579 ; CHECK-ARM-NEXT: cmp lr, r4
580 ; CHECK-ARM-NEXT: movvc r0, r6
581 ; CHECK-ARM-NEXT: subs r6, r1, r7
582 ; CHECK-ARM-NEXT: mov r4, #0
583 ; CHECK-ARM-NEXT: mov lr, #-2147483648
584 ; CHECK-ARM-NEXT: movmi r4, #1
585 ; CHECK-ARM-NEXT: cmp r4, #0
586 ; CHECK-ARM-NEXT: mvnne lr, #-2147483648
587 ; CHECK-ARM-NEXT: cmp r1, r7
588 ; CHECK-ARM-NEXT: ldr r1, [sp, #32]
589 ; CHECK-ARM-NEXT: movvc lr, r6
590 ; CHECK-ARM-NEXT: mov r4, #0
591 ; CHECK-ARM-NEXT: subs r6, r2, r1
592 ; CHECK-ARM-NEXT: movmi r4, #1
593 ; CHECK-ARM-NEXT: cmp r4, #0
594 ; CHECK-ARM-NEXT: mov r4, #-2147483648
595 ; CHECK-ARM-NEXT: mvnne r4, #-2147483648
596 ; CHECK-ARM-NEXT: cmp r2, r1
597 ; CHECK-ARM-NEXT: ldr r1, [sp, #36]
598 ; CHECK-ARM-NEXT: movvc r4, r6
599 ; CHECK-ARM-NEXT: subs r2, r3, r1
600 ; CHECK-ARM-NEXT: movmi r5, #1
601 ; CHECK-ARM-NEXT: cmp r5, #0
602 ; CHECK-ARM-NEXT: mvnne r12, #-2147483648
603 ; CHECK-ARM-NEXT: cmp r3, r1
604 ; CHECK-ARM-NEXT: movvc r12, r2
605 ; CHECK-ARM-NEXT: mov r1, lr
606 ; CHECK-ARM-NEXT: mov r2, r4
607 ; CHECK-ARM-NEXT: mov r3, r12
608 ; CHECK-ARM-NEXT: pop {r4, r5, r6, r7, r11, pc}
533 ; CHECK-T2NODSP-LABEL: vec:
534 ; CHECK-T2NODSP: @ %bb.0:
535 ; CHECK-T2NODSP-NEXT: .save {r4, r5, r6, r7, lr}
536 ; CHECK-T2NODSP-NEXT: push {r4, r5, r6, r7, lr}
537 ; CHECK-T2NODSP-NEXT: .pad #4
538 ; CHECK-T2NODSP-NEXT: sub sp, #4
539 ; CHECK-T2NODSP-NEXT: ldr r4, [sp, #24]
540 ; CHECK-T2NODSP-NEXT: mov lr, r0
541 ; CHECK-T2NODSP-NEXT: ldr r7, [sp, #28]
542 ; CHECK-T2NODSP-NEXT: movs r5, #0
543 ; CHECK-T2NODSP-NEXT: subs r6, r0, r4
544 ; CHECK-T2NODSP-NEXT: mov.w r0, #0
545 ; CHECK-T2NODSP-NEXT: it mi
546 ; CHECK-T2NODSP-NEXT: movmi r0, #1
547 ; CHECK-T2NODSP-NEXT: cmp r0, #0
548 ; CHECK-T2NODSP-NEXT: mov.w r0, #-2147483648
549 ; CHECK-T2NODSP-NEXT: mov.w r12, #-2147483648
550 ; CHECK-T2NODSP-NEXT: it ne
551 ; CHECK-T2NODSP-NEXT: mvnne r0, #-2147483648
552 ; CHECK-T2NODSP-NEXT: cmp lr, r4
553 ; CHECK-T2NODSP-NEXT: it vc
554 ; CHECK-T2NODSP-NEXT: movvc r0, r6
555 ; CHECK-T2NODSP-NEXT: subs r6, r1, r7
556 ; CHECK-T2NODSP-NEXT: mov.w r4, #0
557 ; CHECK-T2NODSP-NEXT: mov.w lr, #-2147483648
558 ; CHECK-T2NODSP-NEXT: it mi
559 ; CHECK-T2NODSP-NEXT: movmi r4, #1
560 ; CHECK-T2NODSP-NEXT: cmp r4, #0
561 ; CHECK-T2NODSP-NEXT: it ne
562 ; CHECK-T2NODSP-NEXT: mvnne lr, #-2147483648
563 ; CHECK-T2NODSP-NEXT: cmp r1, r7
564 ; CHECK-T2NODSP-NEXT: ldr r1, [sp, #32]
565 ; CHECK-T2NODSP-NEXT: mov.w r4, #0
566 ; CHECK-T2NODSP-NEXT: it vc
567 ; CHECK-T2NODSP-NEXT: movvc lr, r6
568 ; CHECK-T2NODSP-NEXT: subs r6, r2, r1
569 ; CHECK-T2NODSP-NEXT: it mi
570 ; CHECK-T2NODSP-NEXT: movmi r4, #1
571 ; CHECK-T2NODSP-NEXT: cmp r4, #0
572 ; CHECK-T2NODSP-NEXT: mov.w r4, #-2147483648
573 ; CHECK-T2NODSP-NEXT: it ne
574 ; CHECK-T2NODSP-NEXT: mvnne r4, #-2147483648
575 ; CHECK-T2NODSP-NEXT: cmp r2, r1
576 ; CHECK-T2NODSP-NEXT: ldr r1, [sp, #36]
577 ; CHECK-T2NODSP-NEXT: it vc
578 ; CHECK-T2NODSP-NEXT: movvc r4, r6
579 ; CHECK-T2NODSP-NEXT: subs r2, r3, r1
580 ; CHECK-T2NODSP-NEXT: it mi
581 ; CHECK-T2NODSP-NEXT: movmi r5, #1
582 ; CHECK-T2NODSP-NEXT: cmp r5, #0
583 ; CHECK-T2NODSP-NEXT: it ne
584 ; CHECK-T2NODSP-NEXT: mvnne r12, #-2147483648
585 ; CHECK-T2NODSP-NEXT: cmp r3, r1
586 ; CHECK-T2NODSP-NEXT: it vc
587 ; CHECK-T2NODSP-NEXT: movvc r12, r2
588 ; CHECK-T2NODSP-NEXT: mov r1, lr
589 ; CHECK-T2NODSP-NEXT: mov r2, r4
590 ; CHECK-T2NODSP-NEXT: mov r3, r12
591 ; CHECK-T2NODSP-NEXT: add sp, #4
592 ; CHECK-T2NODSP-NEXT: pop {r4, r5, r6, r7, pc}
593 ;
594 ; CHECK-T2DSP-LABEL: vec:
595 ; CHECK-T2DSP: @ %bb.0:
596 ; CHECK-T2DSP-NEXT: ldr.w r12, [sp]
597 ; CHECK-T2DSP-NEXT: qsub r0, r0, r12
598 ; CHECK-T2DSP-NEXT: ldr.w r12, [sp, #4]
599 ; CHECK-T2DSP-NEXT: qsub r1, r1, r12
600 ; CHECK-T2DSP-NEXT: ldr.w r12, [sp, #8]
601 ; CHECK-T2DSP-NEXT: qsub r2, r2, r12
602 ; CHECK-T2DSP-NEXT: ldr.w r12, [sp, #12]
603 ; CHECK-T2DSP-NEXT: qsub r3, r3, r12
604 ; CHECK-T2DSP-NEXT: bx lr
605 ;
606 ; CHECK-ARMNODPS-LABEL: vec:
607 ; CHECK-ARMNODPS: @ %bb.0:
608 ; CHECK-ARMNODPS-NEXT: .save {r4, r5, r6, r7, r11, lr}
609 ; CHECK-ARMNODPS-NEXT: push {r4, r5, r6, r7, r11, lr}
610 ; CHECK-ARMNODPS-NEXT: ldr r4, [sp, #24]
611 ; CHECK-ARMNODPS-NEXT: mov lr, r0
612 ; CHECK-ARMNODPS-NEXT: ldr r7, [sp, #28]
613 ; CHECK-ARMNODPS-NEXT: mov r5, #0
614 ; CHECK-ARMNODPS-NEXT: subs r6, r0, r4
615 ; CHECK-ARMNODPS-NEXT: mov r0, #0
616 ; CHECK-ARMNODPS-NEXT: movmi r0, #1
617 ; CHECK-ARMNODPS-NEXT: cmp r0, #0
618 ; CHECK-ARMNODPS-NEXT: mov r0, #-2147483648
619 ; CHECK-ARMNODPS-NEXT: mov r12, #-2147483648
620 ; CHECK-ARMNODPS-NEXT: mvnne r0, #-2147483648
621 ; CHECK-ARMNODPS-NEXT: cmp lr, r4
622 ; CHECK-ARMNODPS-NEXT: movvc r0, r6
623 ; CHECK-ARMNODPS-NEXT: subs r6, r1, r7
624 ; CHECK-ARMNODPS-NEXT: mov r4, #0
625 ; CHECK-ARMNODPS-NEXT: mov lr, #-2147483648
626 ; CHECK-ARMNODPS-NEXT: movmi r4, #1
627 ; CHECK-ARMNODPS-NEXT: cmp r4, #0
628 ; CHECK-ARMNODPS-NEXT: mvnne lr, #-2147483648
629 ; CHECK-ARMNODPS-NEXT: cmp r1, r7
630 ; CHECK-ARMNODPS-NEXT: ldr r1, [sp, #32]
631 ; CHECK-ARMNODPS-NEXT: movvc lr, r6
632 ; CHECK-ARMNODPS-NEXT: mov r4, #0
633 ; CHECK-ARMNODPS-NEXT: subs r6, r2, r1
634 ; CHECK-ARMNODPS-NEXT: movmi r4, #1
635 ; CHECK-ARMNODPS-NEXT: cmp r4, #0
636 ; CHECK-ARMNODPS-NEXT: mov r4, #-2147483648
637 ; CHECK-ARMNODPS-NEXT: mvnne r4, #-2147483648
638 ; CHECK-ARMNODPS-NEXT: cmp r2, r1
639 ; CHECK-ARMNODPS-NEXT: ldr r1, [sp, #36]
640 ; CHECK-ARMNODPS-NEXT: movvc r4, r6
641 ; CHECK-ARMNODPS-NEXT: subs r2, r3, r1
642 ; CHECK-ARMNODPS-NEXT: movmi r5, #1
643 ; CHECK-ARMNODPS-NEXT: cmp r5, #0
644 ; CHECK-ARMNODPS-NEXT: mvnne r12, #-2147483648
645 ; CHECK-ARMNODPS-NEXT: cmp r3, r1
646 ; CHECK-ARMNODPS-NEXT: movvc r12, r2
647 ; CHECK-ARMNODPS-NEXT: mov r1, lr
648 ; CHECK-ARMNODPS-NEXT: mov r2, r4
649 ; CHECK-ARMNODPS-NEXT: mov r3, r12
650 ; CHECK-ARMNODPS-NEXT: pop {r4, r5, r6, r7, r11, pc}
651 ;
652 ; CHECK-ARMBASEDSP-LABEL: vec:
653 ; CHECK-ARMBASEDSP: @ %bb.0:
654 ; CHECK-ARMBASEDSP-NEXT: ldr r12, [sp]
655 ; CHECK-ARMBASEDSP-NEXT: qsub r0, r0, r12
656 ; CHECK-ARMBASEDSP-NEXT: ldr r12, [sp, #4]
657 ; CHECK-ARMBASEDSP-NEXT: qsub r1, r1, r12
658 ; CHECK-ARMBASEDSP-NEXT: ldr r12, [sp, #8]
659 ; CHECK-ARMBASEDSP-NEXT: qsub r2, r2, r12
660 ; CHECK-ARMBASEDSP-NEXT: ldr r12, [sp, #12]
661 ; CHECK-ARMBASEDSP-NEXT: qsub r3, r3, r12
662 ; CHECK-ARMBASEDSP-NEXT: bx lr
663 ;
664 ; CHECK-ARMDSP-LABEL: vec:
665 ; CHECK-ARMDSP: @ %bb.0:
666 ; CHECK-ARMDSP-NEXT: ldr r12, [sp]
667 ; CHECK-ARMDSP-NEXT: qsub r0, r0, r12
668 ; CHECK-ARMDSP-NEXT: ldr r12, [sp, #4]
669 ; CHECK-ARMDSP-NEXT: qsub r1, r1, r12
670 ; CHECK-ARMDSP-NEXT: ldr r12, [sp, #8]
671 ; CHECK-ARMDSP-NEXT: qsub r2, r2, r12
672 ; CHECK-ARMDSP-NEXT: ldr r12, [sp, #12]
673 ; CHECK-ARMDSP-NEXT: qsub r3, r3, r12
674 ; CHECK-ARMDSP-NEXT: bx lr
609675 %tmp = call <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %x, <4 x i32> %y)
610676 ret <4 x i32> %tmp
611677 }
4343 ; CHECK-T1-NEXT: .LCPI0_0:
4444 ; CHECK-T1-NEXT: .long 2147483647 @ 0x7fffffff
4545 ;
46 ; CHECK-T2-LABEL: func32:
47 ; CHECK-T2: @ %bb.0:
48 ; CHECK-T2-NEXT: .save {r7, lr}
49 ; CHECK-T2-NEXT: push {r7, lr}
50 ; CHECK-T2-NEXT: mls r12, r1, r2, r0
51 ; CHECK-T2-NEXT: mov.w lr, #0
52 ; CHECK-T2-NEXT: mov.w r3, #-2147483648
53 ; CHECK-T2-NEXT: muls r1, r2, r1
54 ; CHECK-T2-NEXT: cmp.w r12, #0
55 ; CHECK-T2-NEXT: it mi
56 ; CHECK-T2-NEXT: movmi.w lr, #1
57 ; CHECK-T2-NEXT: cmp.w lr, #0
58 ; CHECK-T2-NEXT: it ne
59 ; CHECK-T2-NEXT: mvnne r3, #-2147483648
60 ; CHECK-T2-NEXT: cmp r0, r1
61 ; CHECK-T2-NEXT: it vc
62 ; CHECK-T2-NEXT: movvc r3, r12
63 ; CHECK-T2-NEXT: mov r0, r3
64 ; CHECK-T2-NEXT: pop {r7, pc}
46 ; CHECK-T2NODSP-LABEL: func32:
47 ; CHECK-T2NODSP: @ %bb.0:
48 ; CHECK-T2NODSP-NEXT: .save {r7, lr}
49 ; CHECK-T2NODSP-NEXT: push {r7, lr}
50 ; CHECK-T2NODSP-NEXT: mls r12, r1, r2, r0
51 ; CHECK-T2NODSP-NEXT: mov.w lr, #0
52 ; CHECK-T2NODSP-NEXT: mov.w r3, #-2147483648
53 ; CHECK-T2NODSP-NEXT: muls r1, r2, r1
54 ; CHECK-T2NODSP-NEXT: cmp.w r12, #0
55 ; CHECK-T2NODSP-NEXT: it mi
56 ; CHECK-T2NODSP-NEXT: movmi.w lr, #1
57 ; CHECK-T2NODSP-NEXT: cmp.w lr, #0
58 ; CHECK-T2NODSP-NEXT: it ne
59 ; CHECK-T2NODSP-NEXT: mvnne r3, #-2147483648
60 ; CHECK-T2NODSP-NEXT: cmp r0, r1
61 ; CHECK-T2NODSP-NEXT: it vc
62 ; CHECK-T2NODSP-NEXT: movvc r3, r12
63 ; CHECK-T2NODSP-NEXT: mov r0, r3
64 ; CHECK-T2NODSP-NEXT: pop {r7, pc}
65 ;
66 ; CHECK-T2DSP-LABEL: func32:
67 ; CHECK-T2DSP: @ %bb.0:
68 ; CHECK-T2DSP-NEXT: muls r1, r2, r1
69 ; CHECK-T2DSP-NEXT: qsub r0, r0, r1
70 ; CHECK-T2DSP-NEXT: bx lr
6571 ;
6672 ; CHECK-ARM-LABEL: func32:
6773 ; CHECK-ARM: @ %bb.0:
68 ; CHECK-ARM-NEXT: mls r3, r1, r2, r0
69 ; CHECK-ARM-NEXT: mul r12, r1, r2
70 ; CHECK-ARM-NEXT: mov r2, #0
71 ; CHECK-ARM-NEXT: mov r1, #-2147483648
72 ; CHECK-ARM-NEXT: cmp r3, #0
73 ; CHECK-ARM-NEXT: movwmi r2, #1
74 ; CHECK-ARM-NEXT: cmp r2, #0
75 ; CHECK-ARM-NEXT: mvnne r1, #-2147483648
76 ; CHECK-ARM-NEXT: cmp r0, r12
77 ; CHECK-ARM-NEXT: movvc r1, r3
78 ; CHECK-ARM-NEXT: mov r0, r1
74 ; CHECK-ARM-NEXT: mul r1, r1, r2
75 ; CHECK-ARM-NEXT: qsub r0, r0, r1
7976 ; CHECK-ARM-NEXT: bx lr
8077 %a = mul i32 %y, %z
8178 %tmp = call i32 @llvm.ssub.sat.i32(i32 %x, i32 %a)
350347 ; CHECK-T1-NEXT: .LBB4_4:
351348 ; CHECK-T1-NEXT: bx lr
352349 ;
353 ; CHECK-T2-LABEL: func4:
354 ; CHECK-T2: @ %bb.0:
355 ; CHECK-T2-NEXT: muls r1, r2, r1
356 ; CHECK-T2-NEXT: lsls r1, r1, #28
357 ; CHECK-T2-NEXT: sub.w r0, r0, r1, asr #28
358 ; CHECK-T2-NEXT: cmp r0, #7
359 ; CHECK-T2-NEXT: it ge
360 ; CHECK-T2-NEXT: movge r0, #7
361 ; CHECK-T2-NEXT: cmn.w r0, #8
362 ; CHECK-T2-NEXT: it le
363 ; CHECK-T2-NEXT: mvnle r0, #7
364 ; CHECK-T2-NEXT: bx lr
350 ; CHECK-T2NODSP-LABEL: func4:
351 ; CHECK-T2NODSP: @ %bb.0:
352 ; CHECK-T2NODSP-NEXT: muls r1, r2, r1
353 ; CHECK-T2NODSP-NEXT: lsls r1, r1, #28
354 ; CHECK-T2NODSP-NEXT: sub.w r0, r0, r1, asr #28
355 ; CHECK-T2NODSP-NEXT: cmp r0, #7
356 ; CHECK-T2NODSP-NEXT: it ge
357 ; CHECK-T2NODSP-NEXT: movge r0, #7
358 ; CHECK-T2NODSP-NEXT: cmn.w r0, #8
359 ; CHECK-T2NODSP-NEXT: it le
360 ; CHECK-T2NODSP-NEXT: mvnle r0, #7
361 ; CHECK-T2NODSP-NEXT: bx lr
362 ;
363 ; CHECK-T2DSP-LABEL: func4:
364 ; CHECK-T2DSP: @ %bb.0:
365 ; CHECK-T2DSP-NEXT: muls r1, r2, r1
366 ; CHECK-T2DSP-NEXT: lsls r0, r0, #28
367 ; CHECK-T2DSP-NEXT: lsls r1, r1, #28
368 ; CHECK-T2DSP-NEXT: qsub r0, r0, r1
369 ; CHECK-T2DSP-NEXT: asrs r0, r0, #28
370 ; CHECK-T2DSP-NEXT: bx lr
365371 ;
366372 ; CHECK-ARM-LABEL: func4:
367373 ; CHECK-ARM: @ %bb.0:
368374 ; CHECK-ARM-NEXT: smulbb r1, r1, r2
375 ; CHECK-ARM-NEXT: lsl r0, r0, #28
369376 ; CHECK-ARM-NEXT: lsl r1, r1, #28
370 ; CHECK-ARM-NEXT: sub r0, r0, r1, asr #28
371 ; CHECK-ARM-NEXT: cmp r0, #7
372 ; CHECK-ARM-NEXT: movge r0, #7
373 ; CHECK-ARM-NEXT: cmn r0, #8
374 ; CHECK-ARM-NEXT: mvnle r0, #7
377 ; CHECK-ARM-NEXT: qsub r0, r0, r1
378 ; CHECK-ARM-NEXT: asr r0, r0, #28
375379 ; CHECK-ARM-NEXT: bx lr
376380 %a = mul i4 %y, %z
377381 %tmp = call i4 @llvm.ssub.sat.i4(i4 %x, i4 %a)