[llvm] [RISCV] Use DefaultAttrsIntrinsic for some vector intrinsics. (PR #94819)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 16:59:19 PDT 2024


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/94819

This adds IntrWillReturn, IntrNoSync, IntrNoFree, and IntrNoCallback. The IntrWillReturn is needed to make the intrinsic eligible for being dead code eliminated if they are unused.

We already use this for most intrinsics. I wonder if the rounding mode intrinsics were in review when the other intrinsics were changed to DefaultAttrsIntrinsic.

>From 0dd540d98623e0fe346253e3b53cc003c411166c Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 7 Jun 2024 16:56:27 -0700
Subject: [PATCH] [RISCV] Use DefaultAttrsIntrinsic for some vector intrinsics.

This adds IntrWillReturn, IntrNoSync, IntrNoFree, and IntrNoCallback.
The IntrWillReturn is needed to make the intrinsic eligible for
being dead code eliminated if they are unused.

We already use this for most intrinsics. I wonder if the rounding
mode intrinsics were in review when the other intrinsics were
changed to DefaultAttrsIntrinsic.
---
 llvm/include/llvm/IR/IntrinsicsRISCV.td | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/include/llvm/IR/IntrinsicsRISCV.td b/llvm/include/llvm/IR/IntrinsicsRISCV.td
index 4c4e7351212f8..2da154c300344 100644
--- a/llvm/include/llvm/IR/IntrinsicsRISCV.td
+++ b/llvm/include/llvm/IR/IntrinsicsRISCV.td
@@ -144,14 +144,14 @@ class RISCVVIntrinsic {
 
 let TargetPrefix = "riscv" in {
   // We use anyint here but we only support XLen.
-  def int_riscv_vsetvli   : Intrinsic<[llvm_anyint_ty],
+  def int_riscv_vsetvli   : DefaultAttrsIntrinsic<[llvm_anyint_ty],
                            /* AVL */  [LLVMMatchType<0>,
                            /* VSEW */  LLVMMatchType<0>,
                            /* VLMUL */ LLVMMatchType<0>],
                                       [IntrNoMem,
                                        ImmArg<ArgIndex<1>>,
                                        ImmArg<ArgIndex<2>>]>;
-  def int_riscv_vsetvlimax : Intrinsic<[llvm_anyint_ty],
+  def int_riscv_vsetvlimax : DefaultAttrsIntrinsic<[llvm_anyint_ty],
                             /* VSEW */ [LLVMMatchType<0>,
                             /* VLMUL */ LLVMMatchType<0>],
                                       [IntrNoMem,
@@ -669,7 +669,7 @@ let TargetPrefix = "riscv" in {
   // The destination vector type is the same as first source vector.
   // Input: (passthru, vector_in, vector_in/scalar_in, vxrm, vl)
   class RISCVSaturatingBinaryAAXUnMaskedRoundingMode
-        : Intrinsic<[llvm_anyvector_ty],
+        : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
                     [LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty,
                      llvm_anyint_ty, LLVMMatchType<2>],
                     [ImmArg<ArgIndex<3>>, IntrNoMem]>, RISCVVIntrinsic {
@@ -692,7 +692,7 @@ let TargetPrefix = "riscv" in {
   // The destination vector type is the same as first source vector.
   // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vxrm, vl, policy)
   class RISCVSaturatingBinaryAAXMaskedRoundingMode
-        : Intrinsic<[llvm_anyvector_ty],
+        : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
                     [LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty,
                      LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty,
                      LLVMMatchType<2>, LLVMMatchType<2>],



More information about the llvm-commits mailing list