This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Emit .variant_cc directives for vector function calls.
ClosedPublic

Authored by fakepaper56 on Dec 6 2022, 4:19 AM.

Details

Summary

The patch is splitted from D103435. The patch emits .variant_cc [0] for those
function calls that have vector arguments or vector return values.

[0]: https://github.com/riscv/riscv-elf-psabi-doc/pull/190

Initial authored by: HsiangKai

Diff Detail

Event Timeline

fakepaper56 created this revision.Dec 6 2022, 4:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 4:19 AM
fakepaper56 requested review of this revision.Dec 6 2022, 4:19 AM

LGTM from the psABI perspective, but I would like to wait another week to make sure other review is happy :)

llvm/test/CodeGen/RISCV/rvv/variant-cc.ll
13–18

I am surprise VLS type will set .variant_cc too, but I realized soon that's kind of LLVM ABI extensions.

smd added a subscriber: smd.Dec 9 2022, 12:46 AM
smd added inline comments.
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
233

Hi,
Could this label printing be extended not only for vector calls, but also for functions that has variant_cc flag set?
I guess this is what I need for D132994 to go further.
Thanks

jrtc27 added inline comments.Dec 9 2022, 12:56 AM
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
233

Your code should just be calling emitDirectiveVariantCC, not poking around in the symbol directly. Emitting the directive based on st_other is backwards.

Rebase and ping.

reames accepted this revision.Dec 15 2022, 3:03 PM

There's missing context in the review description which is important. Please add something along the lines of the following.

The currently ratified calling convention in psABI does not support passing vector arguments or return values in registers. LLVM implements a non-standard calling convention for vector arguments and returns. psABI requires that such non-standard calling conventions be tagged w/ .variant_cc.

With that additional context, LGTM.

This revision is now accepted and ready to land.Dec 15 2022, 3:03 PM

Refine commit message. Almost add all reame's description into the the commit message.
Thank reame's suggestion.

This revision was landed with ongoing or failed builds.Dec 15 2022, 9:51 PM
This revision was automatically updated to reflect the committed changes.