; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: .save {r4, r5, r6, lr}
; CHECK-NEXT: push {r4, r5, r6, lr}
-; CHECK-NEXT: cmp r3, #0
-; CHECK-NEXT: beq .LBB5_8
+; CHECK-NEXT: cbz r3, .LBB5_8
; CHECK-NEXT: @ %bb.1: @ %for.body.preheader
; CHECK-NEXT: cmp r3, #3
; CHECK-NEXT: bhi .LBB5_3
; CHECK-NEXT: it eq
; CHECK-NEXT: popeq {r4, r5, r6, pc}
; CHECK-NEXT: .LBB5_6: @ %for.body.preheader21
-; CHECK-NEXT: movw r0, #32768
; CHECK-NEXT: sub.w lr, r3, r5
-; CHECK-NEXT: movt r0, #65535
-; CHECK-NEXT: movw r1, #32767
; CHECK-NEXT: dls lr, lr
; CHECK-NEXT: .LBB5_7: @ %for.body
; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: ldrsh r2, [r12], #2
-; CHECK-NEXT: ldrsh r3, [r6], #2
-; CHECK-NEXT: muls r2, r3, r2
-; CHECK-NEXT: mov r3, r0
-; CHECK-NEXT: cmp.w r0, r2, asr #15
-; CHECK-NEXT: it lt
-; CHECK-NEXT: asrlt r3, r2, #15
-; CHECK-NEXT: cmp r3, r1
-; CHECK-NEXT: csel r2, r3, r1, lt
-; CHECK-NEXT: strh r2, [r4], #2
+; CHECK-NEXT: ldrsh r0, [r12], #2
+; CHECK-NEXT: ldrsh r1, [r6], #2
+; CHECK-NEXT: muls r0, r1, r0
+; CHECK-NEXT: asrs r0, r0, #15
+; CHECK-NEXT: ssat r0, #16, r0
+; CHECK-NEXT: strh r0, [r4], #2
; CHECK-NEXT: le lr, .LBB5_7
; CHECK-NEXT: .LBB5_8: @ %for.cond.cleanup
; CHECK-NEXT: pop {r4, r5, r6, pc}
; CHECK-NEXT: it eq
; CHECK-NEXT: popeq {r4, r5, r6, pc}
; CHECK-NEXT: .LBB6_6: @ %for.body.preheader21
-; CHECK-NEXT: movw r0, #32768
; CHECK-NEXT: sub.w lr, r3, r5
-; CHECK-NEXT: movt r0, #65535
-; CHECK-NEXT: movw r1, #32767
; CHECK-NEXT: dls lr, lr
; CHECK-NEXT: .LBB6_7: @ %for.body
; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: ldrsh r2, [r12], #2
-; CHECK-NEXT: ldrsh r3, [r6], #2
-; CHECK-NEXT: muls r2, r3, r2
-; CHECK-NEXT: mov r3, r0
-; CHECK-NEXT: cmp.w r0, r2, asr #15
-; CHECK-NEXT: it lt
-; CHECK-NEXT: asrlt r3, r2, #15
-; CHECK-NEXT: cmp r3, r1
-; CHECK-NEXT: csel r2, r3, r1, lt
-; CHECK-NEXT: strh r2, [r4], #2
+; CHECK-NEXT: ldrsh r0, [r12], #2
+; CHECK-NEXT: ldrsh r1, [r6], #2
+; CHECK-NEXT: muls r0, r1, r0
+; CHECK-NEXT: asrs r0, r0, #15
+; CHECK-NEXT: ssat r0, #16, r0
+; CHECK-NEXT: strh r0, [r4], #2
; CHECK-NEXT: le lr, .LBB6_7
; CHECK-NEXT: .LBB6_8: @ %for.cond.cleanup
; CHECK-NEXT: pop {r4, r5, r6, pc}
; CHECK-NEXT: it eq
; CHECK-NEXT: popeq {r4, r5, r6, pc}
; CHECK-NEXT: .LBB7_6: @ %for.body.preheader21
-; CHECK-NEXT: movw r0, #32768
; CHECK-NEXT: sub.w lr, r3, r5
-; CHECK-NEXT: movt r0, #65535
-; CHECK-NEXT: movw r1, #32767
; CHECK-NEXT: dls lr, lr
; CHECK-NEXT: .LBB7_7: @ %for.body
; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: ldrsh r2, [r12], #2
-; CHECK-NEXT: ldrsh r3, [r6], #2
-; CHECK-NEXT: muls r2, r3, r2
-; CHECK-NEXT: mov r3, r0
-; CHECK-NEXT: cmp.w r0, r2, asr #15
-; CHECK-NEXT: it lt
-; CHECK-NEXT: asrlt r3, r2, #15
-; CHECK-NEXT: cmp r3, r1
-; CHECK-NEXT: csel r2, r3, r1, lt
-; CHECK-NEXT: strh r2, [r4], #2
+; CHECK-NEXT: ldrsh r0, [r12], #2
+; CHECK-NEXT: ldrsh r1, [r6], #2
+; CHECK-NEXT: muls r0, r1, r0
+; CHECK-NEXT: asrs r0, r0, #15
+; CHECK-NEXT: ssat r0, #16, r0
+; CHECK-NEXT: strh r0, [r4], #2
; CHECK-NEXT: le lr, .LBB7_7
; CHECK-NEXT: .LBB7_8: @ %for.cond.cleanup
; CHECK-NEXT: pop {r4, r5, r6, pc}
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: .save {r4, r5, r6, lr}
; CHECK-NEXT: push {r4, r5, r6, lr}
-; CHECK-NEXT: cmp r3, #0
-; CHECK-NEXT: beq .LBB14_8
+; CHECK-NEXT: cbz r3, .LBB14_8
; CHECK-NEXT: @ %bb.1: @ %for.body.preheader
; CHECK-NEXT: cmp r3, #7
; CHECK-NEXT: bhi .LBB14_3
; CHECK-NEXT: popeq {r4, r5, r6, pc}
; CHECK-NEXT: .LBB14_6: @ %for.body.preheader23
; CHECK-NEXT: sub.w lr, r3, r5
-; CHECK-NEXT: mvn r0, #127
; CHECK-NEXT: dls lr, lr
; CHECK-NEXT: .LBB14_7: @ %for.body
; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: ldrsb r1, [r12], #1
-; CHECK-NEXT: ldrsb r2, [r6], #1
-; CHECK-NEXT: muls r1, r2, r1
-; CHECK-NEXT: mvn r2, #127
-; CHECK-NEXT: cmp.w r0, r1, asr #7
-; CHECK-NEXT: it lt
-; CHECK-NEXT: asrlt r2, r1, #7
-; CHECK-NEXT: cmp r2, #127
-; CHECK-NEXT: it ge
-; CHECK-NEXT: movge r2, #127
-; CHECK-NEXT: strb r2, [r4], #1
+; CHECK-NEXT: ldrsb r0, [r12], #1
+; CHECK-NEXT: ldrsb r1, [r6], #1
+; CHECK-NEXT: muls r0, r1, r0
+; CHECK-NEXT: asrs r0, r0, #7
+; CHECK-NEXT: ssat r0, #8, r0
+; CHECK-NEXT: strb r0, [r4], #1
; CHECK-NEXT: le lr, .LBB14_7
; CHECK-NEXT: .LBB14_8: @ %for.cond.cleanup
; CHECK-NEXT: pop {r4, r5, r6, pc}
; CHECK-NEXT: popeq {r4, r5, r6, pc}
; CHECK-NEXT: .LBB15_6: @ %for.body.preheader23
; CHECK-NEXT: sub.w lr, r3, r5
-; CHECK-NEXT: mvn r0, #127
; CHECK-NEXT: dls lr, lr
; CHECK-NEXT: .LBB15_7: @ %for.body
; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: ldrsb r1, [r12], #1
-; CHECK-NEXT: ldrsb r2, [r6], #1
-; CHECK-NEXT: muls r1, r2, r1
-; CHECK-NEXT: mvn r2, #127
-; CHECK-NEXT: cmp.w r0, r1, asr #7
-; CHECK-NEXT: it lt
-; CHECK-NEXT: asrlt r2, r1, #7
-; CHECK-NEXT: cmp r2, #127
-; CHECK-NEXT: it ge
-; CHECK-NEXT: movge r2, #127
-; CHECK-NEXT: strb r2, [r4], #1
+; CHECK-NEXT: ldrsb r0, [r12], #1
+; CHECK-NEXT: ldrsb r1, [r6], #1
+; CHECK-NEXT: muls r0, r1, r0
+; CHECK-NEXT: asrs r0, r0, #7
+; CHECK-NEXT: ssat r0, #8, r0
+; CHECK-NEXT: strb r0, [r4], #1
; CHECK-NEXT: le lr, .LBB15_7
; CHECK-NEXT: .LBB15_8: @ %for.cond.cleanup
; CHECK-NEXT: pop {r4, r5, r6, pc}
; CHECK-NEXT: popeq {r4, r5, r6, pc}
; CHECK-NEXT: .LBB16_6: @ %for.body.preheader23
; CHECK-NEXT: sub.w lr, r3, r5
-; CHECK-NEXT: mvn r0, #127
; CHECK-NEXT: dls lr, lr
; CHECK-NEXT: .LBB16_7: @ %for.body
; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
-; CHECK-NEXT: ldrsb r1, [r12], #1
-; CHECK-NEXT: ldrsb r2, [r6], #1
-; CHECK-NEXT: muls r1, r2, r1
-; CHECK-NEXT: mvn r2, #127
-; CHECK-NEXT: cmp.w r0, r1, asr #7
-; CHECK-NEXT: it lt
-; CHECK-NEXT: asrlt r2, r1, #7
-; CHECK-NEXT: cmp r2, #127
-; CHECK-NEXT: it ge
-; CHECK-NEXT: movge r2, #127
-; CHECK-NEXT: strb r2, [r4], #1
+; CHECK-NEXT: ldrsb r0, [r12], #1
+; CHECK-NEXT: ldrsb r1, [r6], #1
+; CHECK-NEXT: muls r0, r1, r0
+; CHECK-NEXT: asrs r0, r0, #7
+; CHECK-NEXT: ssat r0, #8, r0
+; CHECK-NEXT: strb r0, [r4], #1
; CHECK-NEXT: le lr, .LBB16_7
; CHECK-NEXT: .LBB16_8: @ %for.cond.cleanup
; CHECK-NEXT: pop {r4, r5, r6, pc}