[X86] Smaller code for materializing 32-bit 1 and -1 constants
authorHans Wennborg <hans@hanshq.net>
Tue, 15 Dec 2015 17:10:28 +0000 (17:10 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 15 Dec 2015 17:10:28 +0000 (17:10 +0000)
commit4bfd3034414d477377a955b3ed52237ec91bdd45
treef3cf53755498024cc7d3c7515f5c2001e1149ef2
parent89c0f842c0dd66c7ac7a1294f5dfdac9a757e27b
[X86] Smaller code for materializing 32-bit 1 and -1 constants

"movl $-1, %eax" is 5 bytes, "xorl %eax, %eax; decl %eax" is 3 bytes.
This commit makes LLVM use the latter when optimizing for size.

Differential Revision: http://reviews.llvm.org/D14971

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255656 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrCompiler.td
lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/materialize-one.ll [new file with mode: 0644]