mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
Make use of the exact bit when optimizing '(X >>exact 3) << 1' to eliminate the
'and' that would zero out the trailing bits, and to produce an exact shift ourselves. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147391 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -542,3 +542,21 @@ define i32 @test45(i32 %a) nounwind {
|
||||
; CHECK-NEXT: %y = lshr i32 %a, 5
|
||||
; CHECK-NEXT: ret i32 %y
|
||||
}
|
||||
|
||||
define i32 @test46(i32 %a) {
|
||||
%y = ashr exact i32 %a, 3
|
||||
%z = shl i32 %y, 1
|
||||
ret i32 %z
|
||||
; CHECK: @test46
|
||||
; CHECK-NEXT: %z = ashr exact i32 %a, 2
|
||||
; CHECK-NEXT: ret i32 %z
|
||||
}
|
||||
|
||||
define i32 @test47(i32 %a) {
|
||||
%y = lshr exact i32 %a, 3
|
||||
%z = shl i32 %y, 1
|
||||
ret i32 %z
|
||||
; CHECK: @test47
|
||||
; CHECK-NEXT: %z = lshr exact i32 %a, 2
|
||||
; CHECK-NEXT: ret i32 %z
|
||||
}
|
||||
|
Reference in New Issue
Block a user