This is an archive of the discontinued LLVM Phabricator instance.

Invalid used of 'w' suffix on push and pop using 64-bit register
ClosedPublic

Authored by avt77 on Oct 6 2017, 7:27 AM.

Details

Summary

This patch fixes PR32806:

The following instruction accesses a 64-bit register, but the mnemonic indicates that it is using a 16-bit register:

  Bytes:            67 49 5e
  Output:         popw %r14
  Expected:      popq %r14

Diff Detail

Repository
rL LLVM

Event Timeline

avt77 created this revision.Oct 6 2017, 7:27 AM
craig.topper added inline comments.
lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
968 ↗(On Diff #117995)

Why are you forcing the XS attribute?

avt77 added inline comments.Oct 17 2017, 5:20 AM
lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
968 ↗(On Diff #117995)

I thought we should transform ADSIZE in XS here. It seems I was wrong: everything works w/o such a transformation. I'll update the patch asap.

avt77 updated this revision to Diff 119305.Oct 17 2017, 6:14 AM

I removed unnecessary attribute usage.

RKSimon added inline comments.Oct 24 2017, 8:01 AM
lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
968 ↗(On Diff #117995)

Can't this be done as just:

attrMask |= ATTR_REXW;
attrMask &= ~ATTR_ADSIZE;
avt77 updated this revision to Diff 120213.Oct 25 2017, 2:13 AM

The fix was refactored accordingly to Simon's suggest.
Could somebody give me LGTM?

RKSimon added inline comments.Oct 25 2017, 5:27 AM
test/MC/Disassembler/X86/x86-64.txt
494 ↗(On Diff #120213)

Can you commit this test now showing the incorrect popw/pushw and then rebase the patch?

avt77 updated this revision to Diff 120567.Oct 27 2017, 3:30 AM

The patch was re-based to show the change in the test.

RKSimon accepted this revision.Oct 27 2017, 4:00 AM

LGTM - thanks

This revision is now accepted and ready to land.Oct 27 2017, 4:00 AM
This revision was automatically updated to reflect the committed changes.