InstSimplify: X >> X -> 0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185973 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2013-07-09 22:01:22 +00:00
parent e4e742a62d
commit 8c5c6f0e09
3 changed files with 27 additions and 3 deletions

View File

@@ -357,6 +357,14 @@ define i1 @lshr2(i32 %x) {
; CHECK: ret i1 false
}
define i1 @lshr3(i32 %x) {
; CHECK: @lshr3
%s = lshr i32 %x, %x
%c = icmp eq i32 %s, 0
ret i1 %c
; CHECK: ret i1 true
}
define i1 @ashr1(i32 %x) {
; CHECK: @ashr1
%s = ashr i32 -1, %x
@@ -373,6 +381,14 @@ define i1 @ashr2(i32 %x) {
; CHECK: ret i1 false
}
define i1 @ashr3(i32 %x) {
; CHECK: @ashr3
%s = ashr i32 %x, %x
%c = icmp eq i32 %s, 0
ret i1 %c
; CHECK: ret i1 true
}
define i1 @select1(i1 %cond) {
; CHECK: @select1
%s = select i1 %cond, i32 1, i32 0