This is an archive of the discontinued LLVM Phabricator instance.

[3/3][RISCV][POC] Model vxrm in C intrinsics for RVV fixed-point instruction vaadd, vasub
ClosedPublic

Authored by eopXD on May 24 2023, 7:11 PM.

Details

Summary

Depends on D151396.

This is the 3rd patch of the patch-set. For the cover letter of the
patch-set, please checkout D151395.

This commit consists of change in both clang front-end and RISC-
back-end.

In the front-end, this commit adds an additional operand to the C
intrinsics of vaadd, vaaddu, vasub, and vasubu, that models
the control of the rounding mode.

In the back-end, using vaadd as an example, this commit replaces the
existing int.riscv.vaadd.* with int.riscv.vaadd.rm.* that was
introduced in the previous patch, with the extra operand that models
the control of the rounding mode (vxrm) for RVV fixed-point
intrinsics.

Note: The first 3 commit of the patch-set shows the intent to model the
rounding mode for fixed-point intrinsics by applying change to
vaadd, vaaddu, vasub, and vasubu. The proceeding patch will
apply the change to the rest of the other fixed-point instructions.

Diff Detail

Event Timeline

eopXD created this revision.May 24 2023, 7:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 7:11 PM
eopXD requested review of this revision.May 24 2023, 7:11 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 24 2023, 7:11 PM
eopXD updated this revision to Diff 525413.May 24 2023, 7:46 PM

Bump CI.

craig.topper added inline comments.May 24 2023, 8:22 PM
clang/include/clang/Basic/riscv_vector.td
2131

Extra blank line

clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vaadd.c
16

The vxrm argument is unused

llvm/include/llvm/IR/IntrinsicsRISCV.td
1365

Why did the intrinsic change names?

craig.topper added inline comments.May 24 2023, 8:37 PM
llvm/include/llvm/IR/IntrinsicsRISCV.td
1365

Nevermind. I misread this.

eopXD updated this revision to Diff 525463.EditedMay 25 2023, 12:17 AM
eopXD marked 3 inline comments as done.

Address comments from Craig. Now the patch includes changes to vaadd, vaaddu, vasub, and vasubu.

eopXD marked an inline comment as done.May 25 2023, 12:18 AM
eopXD added inline comments.
llvm/include/llvm/IR/IntrinsicsRISCV.td
1365

Marking this as done.

eopXD edited the summary of this revision. (Show Details)May 25 2023, 12:19 AM
eopXD edited the summary of this revision. (Show Details)May 25 2023, 12:22 AM
eopXD updated this revision to Diff 525473.May 25 2023, 12:37 AM

Bump CI because previous diff failed in patch application.

eopXD updated this revision to Diff 525951.May 25 2023, 11:14 PM

Resolve test failure.

craig.topper added inline comments.May 31 2023, 1:01 PM
clang/include/clang/Basic/riscv_vector.td
2074

enum name needs __ prefix

2075

These need __ prefix

eopXD updated this revision to Diff 529174.Jun 6 2023, 11:07 PM
eopXD marked 2 inline comments as done.

Address comments from Craig.

eopXD retitled this revision from [3/N][RISCV] Model vxrm in C intrinsics for RVV fixed-point instruction vaadd to [3/3][RISCV][POC] Model vxrm in C intrinsics for RVV fixed-point instruction vaadd, vasub.Jun 8 2023, 9:48 AM
eopXD updated this revision to Diff 529651.Jun 8 2023, 9:56 AM

Rebase.

Do we need to check the immediate range in SemaChecking.cpp?

eopXD updated this revision to Diff 530408.Jun 12 2023, 12:11 AM

Add semantic checking for the vxrm paramter.
Test case are added CodeGen/RISCV/rvv-intrinsics-handcrafted/{vaadd/vaaddu/vasub/vasubu}.

eopXD updated this revision to Diff 531141.Jun 13 2023, 6:44 PM

Fix ManualCodeGen part, the maskedoff parameter was not passed correctly.

eopXD updated this revision to Diff 531144.Jun 13 2023, 6:52 PM

Bump CI.

eopXD updated this revision to Diff 531654.Jun 15 2023, 2:09 AM

Bump CI due to rebase.

eopXD updated this revision to Diff 531676.Jun 15 2023, 3:17 AM

Bump CI due to update of parent revision.

eopXD updated this revision to Diff 531686.Jun 15 2023, 3:55 AM

Remove let hasSideEffects = 0; under
VPseudoBinaryNoMaskRoundingMode, VPseudoBinaryNoMaskTURoundingMode, and VPseudoBinaryMaskPolicyRoundingMode.

eopXD updated this revision to Diff 531687.Jun 15 2023, 3:56 AM

Recover, the previous update should happen under D151396.

eopXD updated this revision to Diff 531689.Jun 15 2023, 3:59 AM

Bump CI.

This revision is now accepted and ready to land.Jun 15 2023, 9:43 AM
eopXD updated this revision to Diff 532531.Jun 18 2023, 10:55 PM

Rebase to latest main.

This revision was landed with ongoing or failed builds.Jun 20 2023, 11:08 AM
This revision was automatically updated to reflect the committed changes.
zixuan-wu added inline comments.
clang/include/clang/Basic/riscv_vector.td
2078

I am wondering if we need a dynamic mode enum which representing using current vxrm value?