This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add vread_csr and vwrite_csr to riscv_vector.h
ClosedPublic

Authored by pcwang-thead on May 18 2022, 4:15 AM.

Details

Summary

These two functions are described in RVV intrinsics doc
to read/write RVV CSRs. This matches what GCC does.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 4:15 AM
pcwang-thead requested review of this revision.May 18 2022, 4:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 4:15 AM
craig.topper added inline comments.May 18 2022, 4:55 PM
clang/include/clang/Basic/riscv_vector.td
1511

Do we need gnu_inline and artificial? The only intrinsics headers that have them in clang are in ppc_wrappers. X86 uses __attribute__((__always_inline__, __nodebug__

1512

X86 and arm_neon.h uses double underscore prefixes on all variables in intrinsic headers to reduce the chance of a collision with a user having a macro with the same name.

clang/include/clang/Basic/riscv_vector.td
1511

I just made it the same as GCC.

1512

The function prototypes have already been defined in RVV intrinsics doc (https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/master/rvv-intrinsic-api.md#readwrite-urw-vector-csrs).

craig.topper added inline comments.May 18 2022, 8:41 PM
clang/include/clang/Basic/riscv_vector.td
1512

I'm only refering to csr, rv and value. Those don't need to match the intrinsics doc. They aren't visible to code using the header.

clang/include/clang/Basic/riscv_vector.td
1512

Oh I get it.

Add double underscore to all variables.

please move those tests to test/CodeGen/RISCV/rvv-intrinsics and rename them without rvv- prefix.

clang/include/clang/Basic/riscv_vector.td
1511

Why do you think making it same as GCC is better than same as other targets in clang?

  • Rebase.
  • move tests to test/CodeGen/RISCV/rvv-intrinsics.
  • Update functions' attrs.
pcwang-thead marked 4 inline comments as done.May 24 2022, 5:53 AM
This revision is now accepted and ready to land.Jun 12 2022, 8:33 PM
pcwang-thead reopened this revision.Jun 13 2022, 4:37 AM
This revision is now accepted and ready to land.Jun 13 2022, 4:37 AM

Add REQUIRES to tests.

This revision was landed with ongoing or failed builds.Jun 13 2022, 5:39 AM
This revision was automatically updated to reflect the committed changes.