Page MenuHomePhabricator

[SVE][Inline-Asm] Support for SVE asm operands
ClosedPublic

Authored by kmclaughlin on Aug 15 2019, 9:01 AM.

Details

Summary

Adds the following inline asm constraints for SVE:

  • w: SVE vector register with full range, Z0 to Z31
  • x: Restricted to registers Z0 to Z15 inclusive.
  • y: Restricted to registers Z0 to Z7 inclusive.

This change also adds the "z" modifier to interpret a register as an SVE register.

Not all of the bitconvert patterns added by this patch are used, but they have been included here for completeness.

Diff Detail

Repository
rL LLVM

Event Timeline

kmclaughlin created this revision.Aug 15 2019, 9:01 AM
Herald added a project: Restricted Project. · View Herald Transcript

Thanks for this change @kmclaughlin.

docs/LangRef.rst
3816 ↗(On Diff #215409)

I noticed this comment does not match the code below, since y only seems to work for scalable vectors, which probably shows this case is missing a test.

  • Added a new test file, aarch64-sve-asm-negative.ll
  • Updated description of the 'y' constraint in LangRef.rst
sdesmalen added inline comments.Wed, Aug 21, 5:40 AM
lib/Target/AArch64/AArch64AsmPrinter.cpp
618 ↗(On Diff #216178)

The use of hasAltName is confusing me here. When I look at the declaration and definition of printAsmRegInClass, the parameter is called bool isVector, and a SVE vector is still a vector, so passing false is odd. I think it makes more sense to change printAsmRegInClass to accept an unsigned AltName, and just pass AArch64::vreg for Neon Vectors directly (or AArch64::NoRegAltName otherwise).

test/CodeGen/AArch64/aarch64-sve-asm-negative.ll
2 ↗(On Diff #216178)

Can you add a comment explaining what this is testing (and why the inline asm below is not valid)?

test/CodeGen/AArch64/aarch64-sve-asm.ll
46 ↗(On Diff #216178)

nit: what is this line doing here?

  • Changed printAsmRegInClass in AArch64AsmPrinter.cpp to accept unsigned AltName instead of bool isVector
  • Added a comment to explain the test in aarch64-sve-asm-negative.ll
  • Removed a confusing comment from AArch64AsmPrinter.cpp
sdesmalen accepted this revision.Thu, Aug 22, 1:30 PM

Thanks for making these changes @kmclaughlin, LGTM!

This revision is now accepted and ready to land.Thu, Aug 22, 1:30 PM
This revision was automatically updated to reflect the committed changes.
gribozavr added inline comments.
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
5836–5837
AArch64ISelLowering.cpp:5837:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
AArch64ISelLowering.cpp:5837:5: note: insert 'LLVM_FALLTHROUGH;' to silence this warning
AArch64ISelLowering.cpp:5837:5: note: insert 'break;' to avoid fall-through

Is the fallthrough intentional?

kmclaughlin marked an inline comment as done.Tue, Sep 3, 9:14 AM
kmclaughlin added a subscriber: ruiu.

Thank you to @gribozavr & @ruiu for spotting the warning caused by this patch, and the suggestions to use -Wimplicit-fallthrough!

llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
5836–5837

The fallthrough was not intentional; this should now be resolved by D67095