1 ; RUN: llc -march=arm -mattr=+v6t2 < %s | FileCheck %s 2 3 %struct.F = type { [3 x i8], i8 } 4 5 @X = common global %struct.F zeroinitializer, align 4 ; <%struct.F*> [#uses=1] 6 7 define void @f1([1 x i32] %f.coerce0) nounwind { 8 entry: 9 ; CHECK: f1 10 ; CHECK: mov r2, #10 11 ; CHECK: bfi r1, r2, #22, #4 12 %0 = load i32* bitcast (%struct.F* @X to i32*), align 4 ; <i32> [#uses=1] 13 %1 = and i32 %0, -62914561 ; <i32> [#uses=1] 14 %2 = or i32 %1, 41943040 ; <i32> [#uses=1] 15 store i32 %2, i32* bitcast (%struct.F* @X to i32*), align 4 16 ret void 17 } 18 19 define i32 @f2(i32 %A, i32 %B) nounwind { 20 entry: 21 ; CHECK: f2 22 ; CHECK: lsr{{.*}}#7 23 ; CHECK: bfi r0, r1, #7, #16 24 %and = and i32 %A, -8388481 ; <i32> [#uses=1] 25 %and2 = and i32 %B, 8388480 ; <i32> [#uses=1] 26 %or = or i32 %and2, %and ; <i32> [#uses=1] 27 ret i32 %or 28 } 29 30 define i32 @f3(i32 %A, i32 %B) nounwind { 31 entry: 32 ; CHECK: f3 33 ; CHECK: lsr{{.*}} #7 34 ; CHECK: bfi {{.*}}, #7, #16 35 %and = and i32 %A, 8388480 ; <i32> [#uses=1] 36 %and2 = and i32 %B, -8388481 ; <i32> [#uses=1] 37 %or = or i32 %and2, %and ; <i32> [#uses=1] 38 ret i32 %or 39 } 40 41 ; rdar://8752056 42 define i32 @f4(i32 %a) nounwind { 43 ; CHECK: f4 44 ; CHECK: movw [[R1:r[0-9]+]], #3137 45 ; CHECK: bfi [[R1]], {{r[0-9]+}}, #15, #5 46 %1 = shl i32 %a, 15 47 %ins7 = and i32 %1, 1015808 48 %ins12 = or i32 %ins7, 3137 49 ret i32 %ins12 50 } 51 52 ; rdar://8458663 53 define i32 @f5(i32 %a, i32 %b) nounwind { 54 entry: 55 ; CHECK: f5: 56 ; CHECK-NOT: bfc 57 ; CHECK: bfi r0, r1, #20, #4 58 %0 = and i32 %a, -15728641 59 %1 = shl i32 %b, 20 60 %2 = and i32 %1, 15728640 61 %3 = or i32 %2, %0 62 ret i32 %3 63 } 64 65 ; rdar://9609030 66 define i32 @f6(i32 %a, i32 %b) nounwind readnone { 67 entry: 68 ; CHECK: f6: 69 ; CHECK-NOT: bic 70 ; CHECK: bfi r0, r1, #8, #9 71 %and = and i32 %a, -130817 72 %and2 = shl i32 %b, 8 73 %shl = and i32 %and2, 130816 74 %or = or i32 %shl, %and 75 ret i32 %or 76 } 77