Page MenuHomePhabricator

[x86] Improve selection of the mov instruction in FrameLowering
Needs ReviewPublic

Authored by nagisa on Mar 21 2021, 5:29 PM.



MOV64ri results in a significantly longer encoding, and use of this operator is fairly avoidable as
we can always check the size of the immediate we're using.

Diff Detail

Event Timeline

nagisa created this revision.Mar 21 2021, 5:29 PM
nagisa published this revision for review.Apr 1 2021, 4:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2021, 4:03 PM

Happy to pre-commit the tests if this is something that we actually want to do.

craig.topper added inline comments.

You also do

if (isUInt<32>(Imm))
  return MOV32ri64;

It's weirdly named but it's load a 32 bit immediate into the lower 32 bits and zero extend. Should avoid a REX prefix I think.


You can drop this else since the if returned.


Can you pretend you pre-commited the test for the purposes of this diff so it's readable?

rnk added a comment.Apr 2 2021, 11:01 AM

Seems reasonable


Offset here is always >2GB, so this is NFC, but still a simplification.