2010-07-16 23:05:05 +00:00
|
|
|
; RUN: llc -march=arm -mattr=+v6t2 < %s | FileCheck %s
|
|
|
|
|
|
|
|
%struct.F = type { [3 x i8], i8 }
|
|
|
|
|
|
|
|
@X = common global %struct.F zeroinitializer, align 4 ; <%struct.F*> [#uses=1]
|
|
|
|
|
|
|
|
define void @f1([1 x i32] %f.coerce0) nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK: f1
|
|
|
|
; CHECK: mov r2, #10
|
|
|
|
; CHECK: bfi r1, r2, #22, #4
|
|
|
|
%0 = load i32* bitcast (%struct.F* @X to i32*), align 4 ; <i32> [#uses=1]
|
|
|
|
%1 = and i32 %0, -62914561 ; <i32> [#uses=1]
|
|
|
|
%2 = or i32 %1, 41943040 ; <i32> [#uses=1]
|
|
|
|
store i32 %2, i32* bitcast (%struct.F* @X to i32*), align 4
|
|
|
|
ret void
|
|
|
|
}
|
2010-07-17 03:30:54 +00:00
|
|
|
|
2010-12-11 04:11:38 +00:00
|
|
|
define i32 @f2(i32 %A, i32 %B) nounwind {
|
2010-07-17 03:30:54 +00:00
|
|
|
entry:
|
|
|
|
; CHECK: f2
|
2010-09-17 21:58:46 +00:00
|
|
|
; CHECK: lsr{{.*}}#7
|
2010-07-17 03:30:54 +00:00
|
|
|
; CHECK: bfi r0, r1, #7, #16
|
|
|
|
%and = and i32 %A, -8388481 ; <i32> [#uses=1]
|
|
|
|
%and2 = and i32 %B, 8388480 ; <i32> [#uses=1]
|
|
|
|
%or = or i32 %and2, %and ; <i32> [#uses=1]
|
|
|
|
ret i32 %or
|
|
|
|
}
|
|
|
|
|
2010-12-11 04:11:38 +00:00
|
|
|
define i32 @f3(i32 %A, i32 %B) nounwind {
|
2010-07-17 03:30:54 +00:00
|
|
|
entry:
|
|
|
|
; CHECK: f3
|
2010-09-17 21:58:46 +00:00
|
|
|
; CHECK: lsr{{.*}} #7
|
2011-05-03 22:31:21 +00:00
|
|
|
; CHECK: bfi {{.*}}, #7, #16
|
2010-07-17 03:30:54 +00:00
|
|
|
%and = and i32 %A, 8388480 ; <i32> [#uses=1]
|
|
|
|
%and2 = and i32 %B, -8388481 ; <i32> [#uses=1]
|
|
|
|
%or = or i32 %and2, %and ; <i32> [#uses=1]
|
|
|
|
ret i32 %or
|
|
|
|
}
|
2010-12-11 04:11:38 +00:00
|
|
|
|
|
|
|
; rdar://8752056
|
|
|
|
define i32 @f4(i32 %a) nounwind {
|
|
|
|
; CHECK: f4
|
2011-05-03 22:31:21 +00:00
|
|
|
; CHECK: movw [[R1:r[0-9]+]], #3137
|
|
|
|
; CHECK: bfi [[R1]], {{r[0-9]+}}, #15, #5
|
2010-12-11 04:11:38 +00:00
|
|
|
%1 = shl i32 %a, 15
|
|
|
|
%ins7 = and i32 %1, 1015808
|
|
|
|
%ins12 = or i32 %ins7, 3137
|
|
|
|
ret i32 %ins12
|
|
|
|
}
|
2010-12-14 03:22:07 +00:00
|
|
|
|
|
|
|
; rdar://8458663
|
|
|
|
define i32 @f5(i32 %a, i32 %b) nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK: f5:
|
|
|
|
; CHECK-NOT: bfc
|
|
|
|
; CHECK: bfi r0, r1, #20, #4
|
|
|
|
%0 = and i32 %a, -15728641
|
|
|
|
%1 = shl i32 %b, 20
|
|
|
|
%2 = and i32 %1, 15728640
|
|
|
|
%3 = or i32 %2, %0
|
|
|
|
ret i32 %3
|
|
|
|
}
|