Skip to content

Commit

Permalink
[RISCV][Clang] Add some RVV Floating-Point intrinsic functions.
Browse files Browse the repository at this point in the history
Support the following instructions which have the same class.
1. Vector Single-Width Floating-Point Subtract Instructions
2. Vector Single-Width Floating-Point Multiply/Divide Instructions
3. Vector Floating-Point MIN/MAX Instructions
4. Vector Floating-Point Sign-Injection Instructions

Reviewed By: craig.topper

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>

Differential Revision: https://reviews.llvm.org/D99668
  • Loading branch information
zakk0610 committed Apr 12, 2021
1 parent ccc624b commit 007ea0e
Show file tree
Hide file tree
Showing 17 changed files with 9,926 additions and 0 deletions.
62 changes: 62 additions & 0 deletions clang/include/clang/Basic/riscv_vector.td
Expand Up @@ -323,6 +323,10 @@ multiclass RVVFloatingBinBuiltinSet
[["vv", "v", "vvv"],
["vf", "v", "vve"]]>;

multiclass RVVFloatingBinVFBuiltinSet
: RVVOutOp1BuiltinSet<NAME, "fd",
[["vf", "v", "vve"]]>;

class RVVIntExt<string intrinsic_name, string suffix, string prototype,
string type_range>
: RVVBuiltin<suffix, prototype, type_range> {
Expand Down Expand Up @@ -767,3 +771,61 @@ defm vnclip : RVVSignedNShiftBuiltinSet;
// 14. Vector Floating-Point Instructions
// 14.2. Vector Single-Width Floating-Point Add/Subtract Instructions
defm vfadd : RVVFloatingBinBuiltinSet;
defm vfsub : RVVFloatingBinBuiltinSet;
defm vfrsub : RVVFloatingBinVFBuiltinSet;

// 14.3. Vector Widening Floating-Point Add/Subtract Instructions
// TODO

// 14.4. Vector Single-Width Floating-Point Multiply/Divide Instructions
defm vfmul : RVVFloatingBinBuiltinSet;
defm vfdiv : RVVFloatingBinBuiltinSet;
defm vfrdiv : RVVFloatingBinVFBuiltinSet;

// 14.5. Vector Widening Floating-Point Multiply
// TODO

// 14.6. Vector Single-Width Floating-Point Fused Multiply-Add Instructions
// TODO

// 14.7. Vector Widening Floating-Point Fused Multiply-Add Instructions
// TODO

// 14.8. Vector Floating-Point Square-Root Instruction
// TODO

// 14.9. Vector Floating-Point Reciprocal Square-Root Estimate Instruction
// TODO

// 14.10. Vector Floating-Point Reciprocal Estimate Instruction
// TODO

// 14.11. Vector Floating-Point MIN/MAX Instructions
defm vfmin : RVVFloatingBinBuiltinSet;
defm vfmax : RVVFloatingBinBuiltinSet;

// 14.12. Vector Floating-Point Sign-Injection Instructions
defm vfsgnj : RVVFloatingBinBuiltinSet;
defm vfsgnjn : RVVFloatingBinBuiltinSet;
defm vfsgnjx : RVVFloatingBinBuiltinSet;

// 14.13. Vector Floating-Point Compare Instructions
// TODO

// 14.14. Vector Floating-Point Classify Instruction
// TODO

// 14.15. Vector Floating-Point Merge Instructio
// TODO

// 14.16. Vector Floating-Point Move Instruction
// TODO

// 14.17. Single-Width Floating-Point/Integer Type-Convert Instructions
// TODO

// 14.18. Widening Floating-Point/Integer Type-Convert Instructions
// TODO

// 14.19. Narrowing Floating-Point/Integer Type-Convert Instructions
// TODO
551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfdiv.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmax.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmin.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfmul.c

Large diffs are not rendered by default.

272 changes: 272 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrdiv.c

Large diffs are not rendered by default.

272 changes: 272 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfrsub.c

Large diffs are not rendered by default.

1,633 changes: 1,633 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsgnj.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfsub.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfdiv.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfmax.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfmin.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfmul.c

Large diffs are not rendered by default.

272 changes: 272 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfrdiv.c

Large diffs are not rendered by default.

272 changes: 272 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfrsub.c

Large diffs are not rendered by default.

1,633 changes: 1,633 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfsgnj.c

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions clang/test/CodeGen/RISCV/rvv-intrinsics/vfsub.c

Large diffs are not rendered by default.

0 comments on commit 007ea0e

Please sign in to comment.