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

llvm-svn: 153741
This commit is contained in:
Benjamin Kramer 2012-03-30 13:02:58 +00:00
parent 36cbf03b9b
commit 88d31b3f0c
1 changed files with 18 additions and 0 deletions

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
//===---------------------------------------------------------------------===//