This is an archive of the discontinued LLVM Phabricator instance.

[X86] Change register&memory TEST instructions from MRMSrcMem to MRMDstMem
ClosedPublic

Authored by craig.topper on Sep 20 2017, 10:09 PM.

Details

Summary

Intel documentation shows the memory operand as the first operand. But we currently treat it as the second operand. Conceptually the order doesn't matter since it doesn't write memory. We have aliases to parse with the operands in either order and the isel matching is commutable.

For the register&register form order does matter for the assembly parser. PR22995 was previously filed and fixed by changing the register&register form from MRMSrcReg to MRMDestReg to match gas. Ideally the memory form should match by using MRMDestMem.

I believe this supercedes D38025 which was trying to switch the register&register form back to pre-PR22995.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 20 2017, 10:09 PM

Looks like objdump also prints the memory on the right in at&t syntax. So this makes our disassembler printing consistent

465e9c:»85 6c 24 58          »test   %ebp,0x58(%rsp)
aymanmus accepted this revision.Oct 1 2017, 1:43 AM

LGTM

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