diff options
author | Jan Wen Voung <jvoung@google.com> | 2012-09-17 22:04:23 +0000 |
---|---|---|
committer | Jan Wen Voung <jvoung@google.com> | 2012-09-17 22:04:23 +0000 |
commit | b024b7014ad13d076cfc3eb2d63c49681ad1bdd0 (patch) | |
tree | 76f352c12f6fc43748b2d31abd63a5080ca9e751 /test/CodeGen/X86/jump_sign.ll | |
parent | 566540332f6fe59e6424dd0d9a06a29e6f19f790 (diff) | |
download | llvm-b024b7014ad13d076cfc3eb2d63c49681ad1bdd0.tar.gz llvm-b024b7014ad13d076cfc3eb2d63c49681ad1bdd0.tar.bz2 llvm-b024b7014ad13d076cfc3eb2d63c49681ad1bdd0.tar.xz |
Add some cases to x86 OptimizeCompare to handle DEC and INC, too.
While we are setting the earlier def to true, also make it live.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/jump_sign.ll')
-rw-r--r-- | test/CodeGen/X86/jump_sign.ll | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/CodeGen/X86/jump_sign.ll b/test/CodeGen/X86/jump_sign.ll index 48e21061d2..0cf397d4af 100644 --- a/test/CodeGen/X86/jump_sign.ll +++ b/test/CodeGen/X86/jump_sign.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86 -mcpu=pentiumpro | FileCheck %s +; RUN: llc < %s -march=x86 -mcpu=pentiumpro -verify-machineinstrs | FileCheck %s define i32 @f(i32 %X) { entry: @@ -253,3 +253,28 @@ return: %retval.0 = phi i8* [ %add.ptr, %if.end ], [ null, %entry ] ret i8* %retval.0 } + +; Test optimizations of dec/inc. +define i32 @dec(i32 %a) nounwind { +entry: +; CHECK: dec: +; CHECK: decl +; CHECK-NOT: test +; CHECK: cmovsl + %sub = sub nsw i32 %a, 1 + %cmp = icmp sgt i32 %sub, 0 + %cond = select i1 %cmp, i32 %sub, i32 0 + ret i32 %cond +} + +define i32 @inc(i32 %a) nounwind { +entry: +; CHECK: inc: +; CHECK: incl +; CHECK-NOT: test +; CHECK: cmovsl + %add = add nsw i32 %a, 1 + %cmp = icmp sgt i32 %add, 0 + %cond = select i1 %cmp, i32 %add, i32 0 + ret i32 %cond +} |