diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-20 01:16:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-20 01:16:03 +0000 |
commit | 46b9efcad75a056f7f77b34bfd488d842afa82e4 (patch) | |
tree | 8c9abafc53bead54519cc137bdec744934136644 /llvm/lib/Target | |
parent | 7bcead020d979055a2da7002fd6a55f87b6fc201 (diff) | |
download | bcm5719-llvm-46b9efcad75a056f7f77b34bfd488d842afa82e4.tar.gz bcm5719-llvm-46b9efcad75a056f7f77b34bfd488d842afa82e4.zip |
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
llvm-svn: 122217
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/X86InstrCompiler.td | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86InstrCompiler.td b/llvm/lib/Target/X86/X86InstrCompiler.td index 724e6b895e4..da5e05a5d7e 100644 --- a/llvm/lib/Target/X86/X86InstrCompiler.td +++ b/llvm/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 |