Emit x86 instructions for: A = B op C, where A and B are 16-bit registers,
authorChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2003 05:53:31 +0000 (05:53 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2003 05:53:31 +0000 (05:53 +0000)
commit43a5ff8d402dcd71629d1ff9f32e8f46806ab8e3
tree9e1d1a4938da970b40dffe0d84d502cb7bd872e7
parente738656c0b380e5059cb522927aeb49554d01e46
Emit x86 instructions for: A = B op C, where A and B are 16-bit registers,
C is a constant which can be sign-extended from 8 bits without value loss,
and op is one of: add, sub, imul, and, or, xor.

This allows the JIT to emit the one byte version of the constant instead of
the two or 4 byte version.  Because these instructions are very common, this
can save a LOT of code space.  For example, I sampled two benchmarks, 176.gcc
and 254.gap.

BM        Old     New    Reduction
176.gcc 2673621 2548962  4.89%
254.gap  498261  475104  4.87%

Note that while the percentage is not spectacular, this did eliminate
124.6 _KILOBYTES_ of codespace from gcc.  Not bad.

Note that this doesn't effect the llc version at all, because the assembler
already does this optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9284 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/PeepholeOptimizer.cpp
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86PeepholeOpt.cpp