diff options
author | Dan Gohman <gohman@apple.com> | 2010-01-11 17:58:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-01-11 17:58:34 +0000 |
commit | e99a3c191e28c66dc00677d02b3090481865a6e9 (patch) | |
tree | a1e4d3496fc34ba17fae5555257944ddaa60aaaa /llvm/lib | |
parent | 9146e44124907679d2b568098a0f922cf93cb3e5 (diff) | |
download | bcm5719-llvm-e99a3c191e28c66dc00677d02b3090481865a6e9.tar.gz bcm5719-llvm-e99a3c191e28c66dc00677d02b3090481865a6e9.zip |
Use a 32-bit and with implicit zero-extension instead of a 64-bit and if it
has an immediate with at least 32 bits of leading zeros, to avoid needing to
materialize that immediate in a register first.
FileCheckize, tidy, and extend a testcase to cover this case.
This fixes rdar://7527390.
llvm-svn: 93160
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86Instr64bit.td | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86Instr64bit.td b/llvm/lib/Target/X86/X86Instr64bit.td index 1835c8feb62..bc36be21955 100644 --- a/llvm/lib/Target/X86/X86Instr64bit.td +++ b/llvm/lib/Target/X86/X86Instr64bit.td @@ -1966,6 +1966,17 @@ def : Pat<(add GR64:$src1, 0x0000000080000000), def : Pat<(store (add (loadi64 addr:$dst), 0x00000000800000000), addr:$dst), (SUB64mi32 addr:$dst, 0xffffffff80000000)>; +// Use a 32-bit and with implicit zero-extension instead of a 64-bit and if it +// has an immediate with at least 32 bits of leading zeros, to avoid needing to +// materialize that immediate in a register first. +def : Pat<(and GR64:$src, i64immZExt32:$imm), + (SUBREG_TO_REG + (i64 0), + (AND32ri + (EXTRACT_SUBREG GR64:$src, x86_subreg_32bit), + imm:$imm), + x86_subreg_32bit)>; + // r & (2^32-1) ==> movz def : Pat<(and GR64:$src, 0x00000000FFFFFFFF), (MOVZX64rr32 (EXTRACT_SUBREG GR64:$src, x86_subreg_32bit))>; |