This is a follow-up to r255656 which uses push-pop for materializing small constants with 3 bytes instead of a 5-byte (or more) mov.
Since it's slower, let's put it under 'minsize'.
Please take a look.
Paths
| Differential D15549
[X86] Use push-pop for materializing small constants under 'minsize' ClosedPublic Authored by hans on Dec 15 2015, 5:28 PM.
Details Summary This is a follow-up to r255656 which uses push-pop for materializing small constants with 3 bytes instead of a 5-byte (or more) mov. Since it's slower, let's put it under 'minsize'. Please take a look.
Diff Detail Event TimelineComment Actions Hi Hans, Compiling int f() { return -1; } with x86_64-pc-win32 gives: f: # @f .Ltmp0: .seh_proc f # BB#0: # %entry .Ltmp1: .seh_endprologue pushl $-1 popl %eax retq .seh_handlerdata .text .Ltmp2: .seh_endproc I believe this is a violation of the x64 ABI because your program has stack pointer adjustments after the prologue without also having a frame pointer. Comment Actions
Thanks for pointing this out. Sounds like we should avoid the push/pop lowering for Win64 in functions without frame pointers, then.
Closed by commit rL255936: [X86] Use push-pop for materializing small constants under 'minsize' (authored by hans). · Explain WhyDec 17 2015, 3:21 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 43085 lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86InstrCompiler.td
lib/Target/X86/X86InstrInfo.h
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.td
test/CodeGen/X86/materialize-one.ll
test/CodeGen/X86/materialize.ll
test/CodeGen/X86/powi.ll
|
This looks correct, but you could write it more simply by unifying 5311-5318 & 5327-5330. They are the same except for the lines that change the result register. You could use getX86SubSuperRegister(MIB->getOperand(0).getReg(), MVT::i64), which will work regardless of whether the original register is 32 or 64 bits.