1 ; RUN: llc -mtriple=thumbv8m.main -mcpu=cortex-m33 -arm-disable-cgp=false -mattr=-use-misched %s -o - | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-NODSP
2 ; RUN: llc -mtriple=thumbv7em %s -arm-disable-cgp=false -arm-enable-scalar-dsp=true -o - | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-DSP
3 ; RUN: llc -mtriple=thumbv8 %s -arm-disable-cgp=false -arm-enable-scalar-dsp=true -arm-enable-scalar-dsp-imms=true -o - | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-DSP-IMM
5 ; CHECK-COMMON-LABEL: eq_sgt
21 ; CHECK-DSP-IMM: uadd8 [[ADD:r[0-9]+]],
22 ; CHECK-DSP-IMM: cmp [[ADD]],
23 ; CHECK-DSP-IMM: subs [[SUB:r[0-9]+]],
24 ; CHECK-DSP-IMM: sxtb [[SEXT0:r[0-9]+]], [[ADD]]
25 ; CHECK-DSP-IMM: sxtb [[SEXT1:r[0-9]+]], [[SUB]]
26 ; CHECK-DSP-IMM: cmp [[SEXT1]], [[SEXT0]]
27 define i8 @eq_sgt(i8* %x, i8 *%y, i8 zeroext %z) {
29 %load0 = load i8, i8* %x, align 1
30 %load1 = load i8, i8* %y, align 1
31 %add = add i8 %load0, %z
32 %sub = sub i8 %load1, 1
33 %cmp = icmp eq i8 %add, 200
34 %cmp1 = icmp sgt i8 %sub, %add
35 %res0 = select i1 %cmp, i8 35, i8 47
36 %res1 = select i1 %cmp1, i8 %res0, i8 %sub
40 ; CHECK-COMMON-LABEL: ugt_slt
57 ; CHECK-DSP-IMM: uadd16 [[ADD:r[0-9]+]],
58 ; CHECK-DSP-IMM: sxth.w [[SEXT:r[0-9]+]], [[ADD]]
59 ; CHECK-DSP-IMM: sxth [[ARG:r[0-9]+]], r2
60 ; CHECK-DSP-IMM: cmp [[SEXT]], [[ARG]]
61 ; CHECK-DSP-IMM-NOT: uxt
62 ; CHECK-DSP-IMM: movs [[ONE:r[0-9]+]], #1
63 ; CHECK-DSP-IMM: usub16 [[SUB:r[0-9]+]], r1, [[ONE]]
64 ; CHECK-DSP-IMM: cmp [[SUB]], r2
65 define i16 @ugt_slt(i16 *%x, i16 zeroext %y, i16 zeroext %z) {
67 %load0 = load i16, i16* %x, align 1
68 %add = add i16 %load0, %z
70 %cmp = icmp slt i16 %add, %z
71 %cmp1 = icmp ugt i16 %sub, %z
72 %res0 = select i1 %cmp, i16 35, i16 -1
73 %res1 = select i1 %cmp1, i16 %res0, i16 0
77 ; CHECK-COMMON-LABEL: urem_trunc_icmps
78 ; CHECK-COMMON-NOT: uxt
79 ; CHECK-COMMON: sxtb [[SEXT:r[0-9]+]],
80 ; CHECK-COMMON: cmp [[SEXT]], #7
81 define void @urem_trunc_icmps(i16** %in, i32* %g, i32* %k) {
83 %ptr = load i16*, i16** %in, align 4
84 %ld = load i16, i16* %ptr, align 2
85 %cmp.i = icmp eq i16 %ld, 0
86 br i1 %cmp.i, label %exit, label %cond.false.i
89 %rem = urem i16 5, %ld
90 %extract.t = trunc i16 %rem to i8
94 %cond.in.i.off0 = phi i8 [ %extract.t, %cond.false.i ], [ %add, %for.inc ]
95 %cmp = icmp sgt i8 %cond.in.i.off0, 7
96 %conv5 = zext i1 %cmp to i32
97 store i32 %conv5, i32* %g, align 4
98 %.pr = load i32, i32* %k, align 4
99 %tobool13150 = icmp eq i32 %.pr, 0
100 br i1 %tobool13150, label %for.inc, label %exit
103 %add = add nuw i8 %cond.in.i.off0, 1