This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Move the even register check for rv32zdinx later in the matching process.
ClosedPublic

Authored by craig.topper on Jan 31 2023, 10:39 AM.

Details

Summary

And remove the IsRV64 checks for isGPRAsFPR and isGPRPF64AsFPR.

Overall I think this results in a better diagnostic experience. We
now do a better job of matching Zdinx instructions even if the registers
aren't correct and report an error for missing features like RV64.

Unfortunately, this makes it difficult to recover the error location
for the invalid odd register when we do report it. But to make up
for it, I gave a more specific error message.

It doesn't look like binutils gives any warning or error for even registers.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 31 2023, 10:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 10:39 AM
craig.topper requested review of this revision.Jan 31 2023, 10:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 10:39 AM
craig.topper edited the summary of this revision. (Show Details)Jan 31 2023, 10:39 AM
asb accepted this revision.Feb 1 2023, 6:40 AM

LGTM. A better error message but less precise error location seems like a fair trade-off to me.

This revision is now accepted and ready to land.Feb 1 2023, 6:40 AM
jrtc27 added a comment.Feb 1 2023, 6:54 AM

Hm, teaching AsmMatcherEmitter to pass ErrorInfo into checkTargetMatchPredicate (and I guess checkEarlyTargetMatchPredicate for completeness) looks pretty straightforward and would restore the ability to point at the operand's loc

llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
377–379

Is there a reason we'd want to keep these two and not just use isGPRAsFPR everywhere?

craig.topper added inline comments.Feb 1 2023, 11:03 AM
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
377–379

No. I'm going to do another pass through this as a follow up. My focus was on getting rid of IsRV64 on register operands.