diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-05-22 08:13:02 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-05-22 08:13:02 +0000 |
commit | 3b4b5367da29a1598dc333acf37652ef286e9225 (patch) | |
tree | 8b0bd3b22763b28ac46b8406336f4fb787e19ab5 /test/CodeGen/X86/peep-test-4.ll | |
parent | 7849728485570f34bb100baef613a80d84450b08 (diff) | |
download | external_llvm-3b4b5367da29a1598dc333acf37652ef286e9225.zip external_llvm-3b4b5367da29a1598dc333acf37652ef286e9225.tar.gz external_llvm-3b4b5367da29a1598dc333acf37652ef286e9225.tar.bz2 |
X86: Remove test instructions proceeding shift by immediate instructions
Allow LLVM to take advantage of shift instructions that set the ZF flag,
making instructions that test the destination superfluous.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/peep-test-4.ll')
-rw-r--r-- | test/CodeGen/X86/peep-test-4.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/CodeGen/X86/peep-test-4.ll b/test/CodeGen/X86/peep-test-4.ll index b670c31..a1eea00 100644 --- a/test/CodeGen/X86/peep-test-4.ll +++ b/test/CodeGen/X86/peep-test-4.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+bmi,+bmi2,+popcnt | FileCheck %s declare void @foo(i32) +declare void @foo64(i64) ; CHECK: neg: ; CHECK: negl %edi @@ -55,6 +56,24 @@ return: ret void } +; CHECK: shri: +; CHECK: shrl $3, %edi +; CHECK-NEXT: je +; CHECK: jmp foo +; CHECK: ret +define void @shri(i32 %x) nounwind { + %ashr = lshr i32 %x, 3 + %cmp = icmp eq i32 %ashr, 0 + br i1 %cmp, label %return, label %bb + +bb: + tail call void @foo(i32 %ashr) + br label %return + +return: + ret void +} + ; CHECK: shl: ; CHECK: addl %edi, %edi ; CHECK-NEXT: je @@ -73,6 +92,24 @@ return: ret void } +; CHECK: shli: +; CHECK: shll $4, %edi +; CHECK-NEXT: je +; CHECK: jmp foo +; CHECK: ret +define void @shli(i32 %x) nounwind { + %shl = shl i32 %x, 4 + %cmp = icmp eq i32 %shl, 0 + br i1 %cmp, label %return, label %bb + +bb: + tail call void @foo(i32 %shl) + br label %return + +return: + ret void +} + ; CHECK: adc: ; CHECK: movabsq $-9223372036854775808, %rax ; CHECK-NEXT: addq %rdi, %rax |