mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Transform (x&C)>V into (x&C)!=0 where possible
When the least bit of C is greater than V, (x&C) must be greater than V if it is not zero, so the comparison can be simplified. Although this was suggested in Target/X86/README.txt, it benefits any architecture with a directly testable form of AND. Patch by Kevin Schoedel git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -677,3 +677,20 @@ define i1 @test66(i64 %A, i64 %B) {
|
||||
; CHECK-NEXT: ret i1 true
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; CHECK: @test67
|
||||
; CHECK: %and = and i32 %x, 96
|
||||
; CHECK: %cmp = icmp ne i32 %and, 0
|
||||
define i1 @test67(i32 %x) nounwind uwtable {
|
||||
%and = and i32 %x, 127
|
||||
%cmp = icmp sgt i32 %and, 31
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; CHECK: @test68
|
||||
; CHECK: %cmp = icmp ugt i32 %and, 30
|
||||
define i1 @test68(i32 %x) nounwind uwtable {
|
||||
%and = and i32 %x, 127
|
||||
%cmp = icmp sgt i32 %and, 30
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user