diff options
author | Michael Liao <michael.liao@intel.com> | 2012-09-10 16:36:16 +0000 |
---|---|---|
committer | Michael Liao <michael.liao@intel.com> | 2012-09-10 16:36:16 +0000 |
commit | c3d5b21c39aaa1734f5dc9cbe5acd119c993d32d (patch) | |
tree | b4cc360322a32e4fd66c2989805d770d3ad93c6f /llvm/test/CodeGen | |
parent | 1f9e7f4f91f19621a5fbcf6bcff9c33ca757b602 (diff) | |
download | bcm5719-llvm-c3d5b21c39aaa1734f5dc9cbe5acd119c993d32d.tar.gz bcm5719-llvm-c3d5b21c39aaa1734f5dc9cbe5acd119c993d32d.zip |
Add boolean simplification support from CMOV
- If a boolean value is generated from CMOV and tested as boolean value,
simplify the use of test result by referencing the original condition.
RDRAND intrinisc is one of such cases.
llvm-svn: 163516
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/X86/bool-simplify.ll | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/X86/bool-simplify.ll b/llvm/test/CodeGen/X86/bool-simplify.ll index 0cb9fd9bc53..09eb5d1038f 100644 --- a/llvm/test/CodeGen/X86/bool-simplify.ll +++ b/llvm/test/CodeGen/X86/bool-simplify.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse41,-avx | FileCheck %s +; RUN: llc < %s -march=x86-64 -mattr=+sse41,-avx,+rdrand | FileCheck %s define i32 @foo(<2 x i64> %c, i32 %a, i32 %b) { %t1 = call i32 @llvm.x86.sse41.ptestz(<2 x i64> %c, <2 x i64> %c) @@ -39,4 +39,20 @@ define i32 @bax(<2 x i64> %c) { ; CHECK: ret } +define i32 @rnd(i32 %arg) nounwind uwtable { + %1 = tail call { i32, i32 } @llvm.x86.rdrand.32() nounwind + %2 = extractvalue { i32, i32 } %1, 0 + %3 = extractvalue { i32, i32 } %1, 1 + %4 = icmp eq i32 %3, 0 + %5 = select i1 %4, i32 0, i32 %arg + %6 = add i32 %5, %2 + ret i32 %6 +; CHECK: rnd +; CHECK: rdrand +; CHECK: cmov +; CHECK-NOT: cmov +; CHECK: ret +} + declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone +declare { i32, i32 } @llvm.x86.rdrand.32() nounwind |