1; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 -show-mc-encoding %s -o - \ 2; RUN: | FileCheck %s 3 4define i32 @f1(i32 %a.s) { 5entry: 6; CHECK-LABEL: f1: 7; CHECK: it eq 8; CHECK: moveq 9 10 %tmp = icmp eq i32 %a.s, 4 11 %tmp1.s = select i1 %tmp, i32 2, i32 3 12 ret i32 %tmp1.s 13} 14 15define i32 @f2(i32 %a.s) { 16entry: 17; CHECK-LABEL: f2: 18; CHECK: it gt 19; CHECK: movgt 20 %tmp = icmp sgt i32 %a.s, 4 21 %tmp1.s = select i1 %tmp, i32 2, i32 3 22 ret i32 %tmp1.s 23} 24 25define i32 @f3(i32 %a.s, i32 %b.s) { 26entry: 27; CHECK-LABEL: f3: 28; CHECK: it lt 29; CHECK: movlt 30 %tmp = icmp slt i32 %a.s, %b.s 31 %tmp1.s = select i1 %tmp, i32 2, i32 3 32 ret i32 %tmp1.s 33} 34 35define i32 @f4(i32 %a.s, i32 %b.s) { 36entry: 37; CHECK-LABEL: f4: 38; CHECK: it le 39; CHECK: movle 40 41 %tmp = icmp sle i32 %a.s, %b.s 42 %tmp1.s = select i1 %tmp, i32 2, i32 3 43 ret i32 %tmp1.s 44} 45 46define i32 @f5(i32 %a.u, i32 %b.u) { 47entry: 48; CHECK-LABEL: f5: 49; CHECK: it ls 50; CHECK: movls 51 %tmp = icmp ule i32 %a.u, %b.u 52 %tmp1.s = select i1 %tmp, i32 2, i32 3 53 ret i32 %tmp1.s 54} 55 56define i32 @f6(i32 %a.u, i32 %b.u) { 57entry: 58; CHECK-LABEL: f6: 59; CHECK: it hi 60; CHECK: movhi 61 %tmp = icmp ugt i32 %a.u, %b.u 62 %tmp1.s = select i1 %tmp, i32 2, i32 3 63 ret i32 %tmp1.s 64} 65 66define i32 @f7(i32 %a, i32 %b, i32 %c) { 67entry: 68; CHECK-LABEL: f7: 69; CHECK: it hi 70; CHECK: lsrhi {{r[0-9]+}} 71 %tmp1 = icmp ugt i32 %a, %b 72 %tmp2 = udiv i32 %c, 3 73 %tmp3 = select i1 %tmp1, i32 %tmp2, i32 3 74 ret i32 %tmp3 75} 76 77define i32 @f8(i32 %a, i32 %b, i32 %c) { 78entry: 79; CHECK-LABEL: f8: 80; CHECK: it lo 81; CHECK: lsllo {{r[0-9]+}} 82 %tmp1 = icmp ult i32 %a, %b 83 %tmp2 = mul i32 %c, 4 84 %tmp3 = select i1 %tmp1, i32 %tmp2, i32 3 85 ret i32 %tmp3 86} 87 88define i32 @f9(i32 %a, i32 %b, i32 %c) { 89entry: 90; CHECK-LABEL: f9: 91; CHECK: it ge 92; CHECK: rorge.w 93 %tmp1 = icmp sge i32 %a, %b 94 %tmp2 = shl i32 %c, 10 95 %tmp3 = lshr i32 %c, 22 96 %tmp4 = or i32 %tmp2, %tmp3 97 %tmp5 = select i1 %tmp1, i32 %tmp4, i32 3 98 ret i32 %tmp5 99} 100 101define i32 @f10(i32 %a, i32 %b) { 102; CHECK-LABEL: f10: 103; CHECK: movwne {{r[0-9]+}}, #1234 @ encoding: [0x40,0xf2,0xd2,0x4{{[0-9a-f]+}}] 104 %tst = icmp ne i32 %a, %b 105 %val = select i1 %tst, i32 1234, i32 12345 106 ret i32 %val 107} 108 109; Make sure we pick the Thumb encoding for movw/movt 110define i32 @f11(i32 %a, i32 %b) { 111; CHECK-LABEL: f11: 112; CHECK: movwne {{r[0-9]+}}, #50033 @ encoding: [0x4c,0xf2,0x71,0x3{{[0-9a-f]+}}] 113 %tst = icmp ne i32 %a, %b 114 %val = select i1 %tst, i32 123454321, i32 543212345 115 ret i32 %val 116} 117