diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-30 13:02:58 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-30 13:02:58 +0000 |
commit | 2f1abe9a5f2f7c4c1b66099b50b7f4095b3f93f8 (patch) | |
tree | 5f32bd9331261d9de9270cf2d0bd62a1a48f123e /lib/Target/X86 | |
parent | 8fd3fcdba8be962aad1ed48bedbfddffc238c657 (diff) |
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
Diffstat (limited to 'lib/Target/X86')
-rw-r--r-- | lib/Target/X86/README.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index f9c1d35743..6a8a4fdf25 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -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 + +//===---------------------------------------------------------------------===// |