[llvm-commits] [llvm] r153741 - /llvm/trunk/lib/Target/X86/README.txt
Benjamin Kramer
benny.kra at googlemail.com
Fri Mar 30 06:02:58 PDT 2012
Author: d0k
Date: Fri Mar 30 08:02:58 2012
New Revision: 153741
URL: http://llvm.org/viewvc/llvm-project?rev=153741&view=rev
Log:
Add a note about a missed cmov -> sbb opportunity.
Modified:
llvm/trunk/lib/Target/X86/README.txt
Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=153741&r1=153740&r2=153741&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Fri Mar 30 08:02:58 2012
@@ -2060,3 +2060,21 @@
The trick is to match "fetch_and_add(X, -C) == C".
//===---------------------------------------------------------------------===//
+
+unsigned t(unsigned a, unsigned b) {
+ return a <= b ? 5 : -5;
+}
+
+We generate:
+ movl $5, %ecx
+ cmpl %esi, %edi
+ movl $-5, %eax
+ cmovbel %ecx, %eax
+
+GCC:
+ cmpl %edi, %esi
+ sbbl %eax, %eax
+ andl $-10, %eax
+ addl $5, %eax
+
+//===---------------------------------------------------------------------===//
More information about the llvm-commits
mailing list