mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
The comparision "max(x,y)==x" is equivalent to "x>=y". Since the max is
often expressed as "x >= y ? x : y", there is a good chance we can extract the existing "x >= y" from it and use that as a replacement for "max(x,y)==x". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131049 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -231,3 +231,39 @@ define i1 @maxmin8(i32 %x, i32 %y, i32 %z) {
|
||||
ret i1 %c
|
||||
; CHECK: ret i1 false
|
||||
}
|
||||
|
||||
define i1 @eqcmp1(i32 %x, i32 %y) {
|
||||
; CHECK: @eqcmp1
|
||||
%c = icmp sge i32 %x, %y
|
||||
%max = select i1 %c, i32 %x, i32 %y
|
||||
%r = icmp eq i32 %max, %x
|
||||
ret i1 %r
|
||||
; CHECK: ret i1 %c
|
||||
}
|
||||
|
||||
define i1 @eqcmp2(i32 %x, i32 %y) {
|
||||
; CHECK: @eqcmp2
|
||||
%c = icmp sge i32 %x, %y
|
||||
%max = select i1 %c, i32 %x, i32 %y
|
||||
%r = icmp eq i32 %x, %max
|
||||
ret i1 %r
|
||||
; CHECK: ret i1 %c
|
||||
}
|
||||
|
||||
define i1 @eqcmp3(i32 %x, i32 %y) {
|
||||
; CHECK: @eqcmp3
|
||||
%c = icmp uge i32 %x, %y
|
||||
%max = select i1 %c, i32 %x, i32 %y
|
||||
%r = icmp eq i32 %max, %x
|
||||
ret i1 %r
|
||||
; CHECK: ret i1 %c
|
||||
}
|
||||
|
||||
define i1 @eqcmp4(i32 %x, i32 %y) {
|
||||
; CHECK: @eqcmp4
|
||||
%c = icmp uge i32 %x, %y
|
||||
%max = select i1 %c, i32 %x, i32 %y
|
||||
%r = icmp eq i32 %x, %max
|
||||
ret i1 %r
|
||||
; CHECK: ret i1 %c
|
||||
}
|
||||
|
Reference in New Issue
Block a user