mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 06:30:19 +00:00
29aeed1bf8
masks to match inversely for the code as is to work. For the example given we actually want: bfi r0, r2, #1, #1 not #0, however, given the way the pattern is written it's not possible at the moment. Fixes rdar://9177502 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128320 91177308-0d34-0410-b5e6-96231b3b80d8
63 lines
1.7 KiB
LLVM
63 lines
1.7 KiB
LLVM
; RUN: llc -march=thumb -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: movs 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
|
|
}
|
|
|
|
define i32 @f2(i32 %A, i32 %B) nounwind readnone optsize {
|
|
entry:
|
|
; CHECK: f2
|
|
; CHECK: lsrs r1, r1, #7
|
|
; 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
|
|
}
|
|
|
|
define i32 @f3(i32 %A, i32 %B) nounwind readnone optsize {
|
|
entry:
|
|
; CHECK: f3
|
|
; CHECK: lsrs r2, r0, #7
|
|
; CHECK: mov r0, r1
|
|
; CHECK: bfi r0, r2, #7, #16
|
|
%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
|
|
}
|
|
|
|
; rdar://8752056
|
|
define i32 @f4(i32 %a) nounwind {
|
|
; CHECK: f4
|
|
; CHECK: movw r1, #3137
|
|
; CHECK: bfi r1, r0, #15, #5
|
|
%1 = shl i32 %a, 15
|
|
%ins7 = and i32 %1, 1015808
|
|
%ins12 = or i32 %ins7, 3137
|
|
ret i32 %ins12
|
|
}
|
|
|
|
; rdar://9177502
|
|
define i32 @f5(i32 %a, i32 %b) nounwind readnone {
|
|
entry:
|
|
; CHECK f5
|
|
; CHECK-NOT: bfi r0, r2, #0, #1
|
|
%and = and i32 %a, 2
|
|
%b.masked = and i32 %b, -2
|
|
%and3 = or i32 %b.masked, %and
|
|
ret i32 %and3
|
|
}
|