This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use clang_builtin_alias for all RISCV vector intrinsics.
ClosedPublic

Authored by craig.topper on Oct 18 2021, 10:49 AM.

Details

Summary

Previously we used builtin_alias for overloaded intrinsics, but
macros for the non-overloaded version. This patch changes the
non-overloaded versions to also use builtin_alias, but without
the overloadable attribute.

Diff Detail

Event Timeline

craig.topper created this revision.Oct 18 2021, 10:49 AM
craig.topper requested review of this revision.Oct 18 2021, 10:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2021, 10:49 AM
Herald added a subscriber: MaskRay. · View Herald Transcript

After preprocessing, macro definitions will disappear, but function declarations will not. This is the benefit of using macro.

After applying D112102, we could still use

#define vadd_vv_i8m1(op0, op1, op2) \
__builtin_rvv_vadd_vv((vint8m1_t)(op0), (vint8m1_t)(op1), (size_t)(op2))

After preprocessing, macro definitions will disappear, but function declarations will not. This is the benefit of using macro.

After applying D112102, we could still use

#define vadd_vv_i8m1(op0, op1, op2) \
__builtin_rvv_vadd_vv((vint8m1_t)(op0), (vint8m1_t)(op1), (size_t)(op2))

Sorry for the disturbing. After removing type string in the builtin definitions, we need a function declaration in the header. Macro doesn't work.

HsiangKai accepted this revision.Oct 20 2021, 2:03 AM

I ran tests under clang/test/CodeGen/RISCV/rvv-intrinsics/. It spent a little more time to run the tests. (previous: 84.01s; apply this patch: 96.43s in my local environment.) We could apply some technic similar to D111617 to reduce the header size. I think to reduce the number of RVV builtins is important in the long run.

This revision is now accepted and ready to land.Oct 20 2021, 2:03 AM
khchen accepted this revision.Oct 20 2021, 3:06 AM

LGTM.

This revision was landed with ongoing or failed builds.Oct 20 2021, 8:52 AM
This revision was automatically updated to reflect the committed changes.