summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/select.ll
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-12-22 23:09:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-12-22 23:09:28 +0000
commit6020ed9d99cf3af0ff819d1e9d763931c0506e17 (patch)
tree8f1656ce9d23b976c6542dd21ed6c6469ab9c876 /llvm/test/CodeGen/X86/select.ll
parentcdbe59484100e649e837561ca46141be73987b0b (diff)
downloadbcm5719-llvm-6020ed9d99cf3af0ff819d1e9d763931c0506e17.tar.gz
bcm5719-llvm-6020ed9d99cf3af0ff819d1e9d763931c0506e17.zip
X86: Lower a select directly to a setcc_carry if possible.
int test(unsigned long a, unsigned long b) { return -(a < b); } compiles to _test: ## @test cmpq %rsi, %rdi ## encoding: [0x48,0x39,0xf7] sbbl %eax, %eax ## encoding: [0x19,0xc0] ret ## encoding: [0xc3] instead of _test: ## @test xorl %ecx, %ecx ## encoding: [0x31,0xc9] cmpq %rsi, %rdi ## encoding: [0x48,0x39,0xf7] movl $-1, %eax ## encoding: [0xb8,0xff,0xff,0xff,0xff] cmovael %ecx, %eax ## encoding: [0x0f,0x43,0xc1] ret ## encoding: [0xc3] llvm-svn: 122451
Diffstat (limited to 'llvm/test/CodeGen/X86/select.ll')
-rw-r--r--llvm/test/CodeGen/X86/select.ll21
1 files changed, 19 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/select.ll b/llvm/test/CodeGen/X86/select.ll
index 9df23f17468..ce04e07854a 100644
--- a/llvm/test/CodeGen/X86/select.ll
+++ b/llvm/test/CodeGen/X86/select.ll
@@ -197,7 +197,24 @@ entry:
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) nounwind readnone
+define i32 @test13(i32 %a, i32 %b) nounwind {
+ %c = icmp ult i32 %a, %b
+ %d = sext i1 %c to i32
+ ret i32 %d
+; CHECK: test13:
+; CHECK: cmpl
+; CHECK-NEXT: sbbl
+; CHECK-NEXT: ret
+}
-
-
+define i32 @test14(i32 %a, i32 %b) nounwind {
+ %c = icmp uge i32 %a, %b
+ %d = sext i1 %c to i32
+ ret i32 %d
+; CHECK: test14:
+; CHECK: cmpl
+; CHECK-NEXT: sbbl
+; CHECK-NEXT: notl
+; CHECK-NEXT: ret
+}
OpenPOWER on IntegriCloud