mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
InstCombine: Reduce "X shift (A srem B)" to "X shift (A urem B)" iff B is positive.
This allows to transform the rem in "1 << ((int)x % 8);" to an and. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -441,3 +441,14 @@ entry:
|
||||
; CHECK: %ins = or i128 %tmp23, %A
|
||||
; CHECK: %tmp46 = trunc i128 %ins to i64
|
||||
}
|
||||
|
||||
define i32 @test38(i32 %x) nounwind readnone {
|
||||
entry:
|
||||
%rem = srem i32 %x, 32
|
||||
%shl = shl i32 1, %rem
|
||||
ret i32 %shl
|
||||
; CHECK: @test38
|
||||
; CHECK-NOT: srem
|
||||
; CHECK: ret i32
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user