This is an archive of the discontinued LLVM Phabricator instance.

[Clang][RISCV] Support half-precision floating point for RVV intrinsics.
ClosedPublic

Authored by HsiangKai on Jun 27 2021, 10:49 PM.

Details

Summary

According to the discussion in https://lists.llvm.org/pipermail/cfe-dev/2021-March/067910.html, we should use _Float16 as the half-precision floating point type.

In this patch, define a new type specifier 'x' for the _Float16 type.

Diff Detail

Event Timeline

HsiangKai created this revision.Jun 27 2021, 10:49 PM
HsiangKai requested review of this revision.Jun 27 2021, 10:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2021, 10:49 PM
HsiangKai edited the summary of this revision. (Show Details)Jun 27 2021, 11:02 PM
craig.topper added inline comments.Jun 28 2021, 9:24 AM
clang/include/clang/Basic/Builtins.def
27–28

This also includes OpenCL half

clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfadd.c
7

Do you plan to bring back the ASM check for all tests?

This all looks good to me except adding back the asm check.
BTW, do we need to attach the half-precision floating point spec link?

HsiangKai added inline comments.Jun 29 2021, 12:29 AM
clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfadd.c
7

No, I will remove it. This is the first patch to enable half-precision for RVV intrinsics. I just added it to ensure the backend could handle it correctly.

  • Correct comments.
  • Remove asm test in clang test cases.
khchen added inline comments.Jul 12 2021, 7:07 PM
clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfadd.c
7

I think you will remove riscv32 tests too, right?

HsiangKai updated this revision to Diff 359178.Jul 15 2021, 5:51 PM

Remove RV32 test cases.

craig.topper added inline comments.Jul 15 2021, 10:53 PM
clang/utils/TableGen/RISCVVEmitter.cpp
511

Can we use an else and an llvm_unreachable or PrintFatalError to avoid repeating the bit widths twices?

Add else and llvm_unreachable() for unhandled floating types.

This revision is now accepted and ready to land.Jul 18 2021, 11:06 PM
This revision was landed with ongoing or failed builds.Jul 19 2021, 8:17 AM
This revision was automatically updated to reflect the committed changes.