This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][Clang] Teach RISCVEmitter to generate BitCast for pointer operands.
ClosedPublic

Authored by fakepaper56 on Jul 3 2022, 5:00 AM.

Details

Summary

RVV C intrinsics use pointers to scalar for base address and their corresponding
IR intrinsics but use pointers to vector. It makes some vector load intrinsics
need specific ManualCodegen and MaskedManualCodegen to just add bitcast for
transforming to IR.

For simplifying riscv_vector.td, the patch make RISCVEmitter detect pointer
operands and bitcast them.

Diff Detail

Event Timeline

fakepaper56 created this revision.Jul 3 2022, 5:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2022, 5:00 AM
fakepaper56 requested review of this revision.Jul 3 2022, 5:00 AM

Align output code in riscv_vector_builtin_cg.inc.

kito-cheng accepted this revision.Jul 4 2022, 7:47 PM

LGTM, thanks for clean this up :)

This revision is now accepted and ready to land.Jul 4 2022, 7:47 PM
khchen added inline comments.Jul 5 2022, 11:40 PM
clang/utils/TableGen/RISCVVEmitter.cpp
111

I feel this logic is not clear for reader, maybe you should add comment to say why the return type -1 are load intrinsics?

fakepaper56 added inline comments.Jul 6 2022, 1:36 AM
clang/utils/TableGen/RISCVVEmitter.cpp
111

You are right. Maybe I could rewrite the message of assertion to "RVVI should be vector load intrinsic, we don't support this feature for stores now."?