This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Disallow vector operand if FPR128 Q register is required.
ClosedPublic

Authored by sdesmalen on May 1 2018, 5:25 AM.

Details

Summary

Patch https://reviews.llvm.org/D41445 changed the behaviour of 'isReg()'
to also return 'true' if the parsed register operand is a vector
register. Code in the AsmMatcher checks if a register is a subclass of the
expected register class. However, even though both parsed registers map
to the same physical register, the 'v' register is of kind 'NeonVector',
where 'q' is of type Scalar, where isSubclass() does not distinguish
between the two cases.

The solution is to use an AsmOperand instead of the register directly,
and use the PredicateMethod to distinguish the two operands.

This fixes for example:

ldr v0, [x0]    // 'v0' is an invalid operand for this instruction
ldr q0, [x0]    // valid

Diff Detail

Repository
rL LLVM

Event Timeline

sdesmalen created this revision.May 1 2018, 5:25 AM
aemerson accepted this revision.May 7 2018, 3:09 AM

Thanks, LGTM.

This revision is now accepted and ready to land.May 7 2018, 3:09 AM
This revision was automatically updated to reflect the committed changes.
ab added a subscriber: ab.May 8 2018, 2:38 PM
ab added inline comments.
llvm/trunk/lib/Target/AArch64/AArch64RegisterInfo.td
617

Minor thing: is there a better name for this method? It took me a second to figure out how it related to the FPR classes (it doesn't ;)