mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-29 13:18:23 +00:00
ARM: spot SBFX-compatbile code expressed with sign_extend_inreg
We were assuming all SBFX-like operations would have the shl/asr form, but often when the field being extracted is an i8 or i16, we end up with a SIGN_EXTEND_INREG acting on a shift instead. Simple enough to check for though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213754 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -45,3 +45,21 @@ entry:
|
||||
%tmp2 = ashr i32 %tmp, 1
|
||||
ret i32 %tmp2
|
||||
}
|
||||
|
||||
define signext i8 @f6(i32 %a) {
|
||||
; CHECK-LABEL: f6:
|
||||
; CHECK: sbfx r0, r0, #23, #8
|
||||
|
||||
%tmp = lshr i32 %a, 23
|
||||
%res = trunc i32 %tmp to i8
|
||||
ret i8 %res
|
||||
}
|
||||
|
||||
define signext i8 @f7(i32 %a) {
|
||||
; CHECK-LABEL: f7:
|
||||
; CHECK-NOT: sbfx
|
||||
|
||||
%tmp = lshr i32 %a, 25
|
||||
%res = trunc i32 %tmp to i8
|
||||
ret i8 %res
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ define i32 @test0(i8 %A) {
|
||||
|
||||
define signext i8 @test1(i32 %A) {
|
||||
; CHECK-LABEL: test1:
|
||||
; CHECK: lsrs r0, r0, #8
|
||||
; CHECK: sxtb r0, r0
|
||||
; CHECK: sbfx r0, r0, #8, #8
|
||||
%B = lshr i32 %A, 8
|
||||
%C = shl i32 %A, 24
|
||||
%D = or i32 %B, %C
|
||||
|
||||
Reference in New Issue
Block a user