summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86InstrCompiler.td
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-20 01:16:03 +0000
committerChris Lattner <sabre@nondot.org>2010-12-20 01:16:03 +0000
commit39ffcb7b62a75d186a7f14b38aacb1615593fdbd (patch)
treee0c8ecf39907ca5a0ffe62d2284762805c7459fa /lib/Target/X86/X86InstrCompiler.td
parentb085181258bf2566e7b58389591acc213b0b2927 (diff)
downloadllvm-39ffcb7b62a75d186a7f14b38aacb1615593fdbd.tar.gz
llvm-39ffcb7b62a75d186a7f14b38aacb1615593fdbd.tar.bz2
llvm-39ffcb7b62a75d186a7f14b38aacb1615593fdbd.tar.xz
We lower setb to sbb with the hope that the and will go away, when it
doesn't, match it back to setb. On a 64-bit version of the testcase before we'd get: movq %rdi, %rax addq %rsi, %rax sbbb %dl, %dl andb $1, %dl ret now we get: movq %rdi, %rax addq %rsi, %rax setb %dl ret git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrCompiler.td')
-rw-r--r--lib/Target/X86/X86InstrCompiler.td6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Target/X86/X86InstrCompiler.td b/lib/Target/X86/X86InstrCompiler.td
index 724e6b895e..da5e05a5d7 100644
--- a/lib/Target/X86/X86InstrCompiler.td
+++ b/lib/Target/X86/X86InstrCompiler.td
@@ -207,6 +207,12 @@ def : Pat<(i32 (sext (i8 (X86setcc_c X86_COND_B, EFLAGS)))),
def : Pat<(i64 (sext (i8 (X86setcc_c X86_COND_B, EFLAGS)))),
(SETB_C64r)>;
+// We canonicalize 'setb' to "(and (sbb reg,reg), 1)" on the hope that the and
+// will be eliminated and that the sbb can be extended up to a wider type. When
+// this happens, it is great. However, if we are left with an 8-bit sbb and an
+// and, we might as well just match it as a setb.
+def : Pat<(and (i8 (X86setcc_c X86_COND_B, EFLAGS)), 1),
+ (SETBr)>;
//===----------------------------------------------------------------------===//
// String Pseudo Instructions