This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix rlist grammar for cm.push, cm.popret, cm.popretz and cm.pop in RISCV zcmp Extension
ClosedPublic

Authored by imkiva on Aug 8 2023, 10:00 PM.

Details

Summary

The register list in the arg string is declared as {$rlist}. This patch removes the wrapping curly brackets because of the following:

  • Curly brackets are the syntax for variant selection, e.g. given X = {v0 | v1}, the result after CodeGenInstruction::FlattenAsmStringVariants should be X[AsmVariantNo].
  • ARM also supports the register list, and they do not use the bracket wrapper.
  • Parse of curly brackets are handled by RISCVAsmParser::parseReglist, the brackets in the td file do not correspond to asm syntax. Thus no testcase is affected.

So the curly brackets here are redundant and will become dangerous if RISCV needs more asm parser variants (took me several hours to figure out some wired assertion failures in a downstream fork)

Diff Detail

Event Timeline

imkiva created this revision.Aug 8 2023, 10:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2023, 10:00 PM
imkiva requested review of this revision.Aug 8 2023, 10:00 PM
imkiva updated this revision to Diff 548460.Aug 8 2023, 10:09 PM

rebased main

imkiva retitled this revision from [RISCV][NFC] Fix rlist grammar in RISCV zcmp Extension to [RISCV] Fix rlist grammar for cm.push, cm.popret, cm.popretz and cm.pop in RISCV zcmp Extension.Aug 8 2023, 10:13 PM
imkiva edited the summary of this revision. (Show Details)
craig.topper added a reviewer: Jim.
Jim added a comment.Aug 8 2023, 11:56 PM

No testcase changed? At least llvm/test/MC/RISCV/rv32zcmp-valid.s.

No testcase changed? At least llvm/test/MC/RISCV/rv32zcmp-valid.s.

RISCVAsmParser etc handle the curly braces already; these curly braces did not correspond to the assembly syntax's.

imkiva edited the summary of this revision. (Show Details)Aug 9 2023, 12:21 AM

No testcase changed? At least llvm/test/MC/RISCV/rv32zcmp-valid.s.

Thanks for pointing this out. I edited the description to clarify according to @jrtc27.

Hi, is this patch being reviewed?

This revision is now accepted and ready to land.Aug 12 2023, 10:49 AM

Sorry to bother again... I just received an email that says 'Flang :: Driver/underscoring.f90' is failing on a ppc64le-flang-rhel-clang buildbot, and I am on the blame list.
I am confused and want to know if this failure is really linked to this patch. Is there any action that I should take?

Sorry to bother again... I just received an email that says 'Flang :: Driver/underscoring.f90' is failing on a ppc64le-flang-rhel-clang buildbot, and I am on the blame list.
I am confused and want to know if this failure is really linked to this patch. Is there any action that I should take?

You can just ignore it if it's definitely not related to your patch. :-)