Page MenuHomePhabricator

[RISCV] Add inline asm constraint 'v' in Clang for RISC-V 'V'.
ClosedPublic

Authored by HsiangKai on Mar 14 2021, 7:48 PM.

Diff Detail

Event Timeline

HsiangKai created this revision.Mar 14 2021, 7:48 PM
HsiangKai requested review of this revision.Mar 14 2021, 7:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2021, 7:48 PM

This seems like the obvious choice for the constraint, but it would be good to ensure there's consensus with GCC people, especially since their assembly constraints are intimately tied to their instruction patterns (or, really, the assembly constraints just expose those and we pretend to be GCC) so they have less flexibility than us.

GCC use vr for vector register and vm for vector mask register.

GCC use vr for vector register and vm for vector mask register.

How does that even work? Aren't multi character strings a set of options?

GCC use vr for vector register and vm for vector mask register.

How does that even work? Aren't multi character strings a set of options?

Hm, apparently multi-character constraints already exist. Not a fan of it as it parses like "vector or register/memory" to me but if that's how GCC needs to internally model its instructions then we have to copy that...

kito-cheng added a comment.EditedMar 15 2021, 8:08 AM

Provide more implementation detail on GCC,

  • if a letter are used as a prefix of multi-char constraint, then it can't be used as a single letter constraint
    • e.g. If we defined vr and vm then we can't define v as constraint
  • constraint with same prefix should have same length
    • e.g. If we defined vr and vm then we can't define vrr since has different length.

And in fact we have defined bunch of predicate prefixed with v[1], but I am open mind to change that if needed since GCC isn't upstream that yet.

[1] https://github.com/riscv/riscv-gcc/blob/riscv-gcc-10.1-rvv-dev/gcc/config/riscv/constraints.md#L117

HsiangKai updated this revision to Diff 333806.Mon, Mar 29, 3:31 AM

Use 'vr' for vector registers and 'vm' for vector mask registers.

This revision is now accepted and ready to land.Mon, Mar 29, 1:45 PM
This revision was landed with ongoing or failed builds.Mon, Mar 29, 6:49 PM
This revision was automatically updated to reflect the committed changes.