diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-08-24 06:49:11 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-08-24 06:49:11 +0000 |
commit | b3eccc7f0b7f1ae6db50ab84c69b16ecd6f1a7ac (patch) | |
tree | fff6554cab59f21f9bacd58badb4e7968cfe983c | |
parent | 62083ec15741030c5fcbc33bbd196595ffc904d9 (diff) | |
download | bcm5719-llvm-b3eccc7f0b7f1ae6db50ab84c69b16ecd6f1a7ac.tar.gz bcm5719-llvm-b3eccc7f0b7f1ae6db50ab84c69b16ecd6f1a7ac.zip |
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests
llvm-svn: 369839
-rw-r--r-- | llvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll b/llvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll index 7128922df74..5964c02228c 100644 --- a/llvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll +++ b/llvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll @@ -263,9 +263,9 @@ define i32 @n21_equality(i32 %x, i32 %y) { ret i32 %r } -; We don't touch sign checks -define i32 @n22_sign_check(i32 %x, i32 %y) { -; CHECK-LABEL: @n22_sign_check( +; There is nothing special about sign-bit-tests, we can fold them. +define i32 @t22_sign_check(i32 %x, i32 %y) { +; CHECK-LABEL: @t22_sign_check( ; CHECK-NEXT: [[T:%.*]] = icmp slt i32 [[X:%.*]], 0 ; CHECK-NEXT: [[R:%.*]] = select i1 [[T]], i32 -1, i32 [[Y:%.*]] ; CHECK-NEXT: ret i32 [[R]] @@ -274,6 +274,16 @@ define i32 @n22_sign_check(i32 %x, i32 %y) { %r = select i1 %t, i32 -1, i32 %y ret i32 %r } +define i32 @t22_sign_check2(i32 %x, i32 %y) { +; CHECK-LABEL: @t22_sign_check2( +; CHECK-NEXT: [[T:%.*]] = icmp sgt i32 [[X:%.*]], -1 +; CHECK-NEXT: [[R:%.*]] = select i1 [[T]], i32 0, i32 [[Y:%.*]] +; CHECK-NEXT: ret i32 [[R]] +; + %t = icmp sgt i32 %x, -1 + %r = select i1 %t, i32 0, i32 %y + ret i32 %r +} ; If the types don't match we currently don't do anything. define i32 @n23_type_mismatch(i64 %x, i32 %y) { |