Add a note about a missed cmov -> sbb opportunity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2012-03-30 13:02:58 +00:00
parent 8fd3fcdba8
commit 2f1abe9a5f

View File

@ -2060,3 +2060,21 @@ Instead we could generate:
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
//===---------------------------------------------------------------------===//