[clang] 0eb0992 - [ARM][MVE][Intrinsics] remove extraneous intrinsics.

Mark Murray via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 13 07:52:30 PST 2019


Author: Mark Murray
Date: 2019-12-13T15:51:31Z
New Revision: 0eb0992739189dba0d86af33722bc27260a9b555

URL: https://github.com/llvm/llvm-project/commit/0eb0992739189dba0d86af33722bc27260a9b555
DIFF: https://github.com/llvm/llvm-project/commit/0eb0992739189dba0d86af33722bc27260a9b555.diff

LOG: [ARM][MVE][Intrinsics] remove extraneous intrinsics.

Summary:
I overstepped my reach and generated too many intrinsics; these never
made it into the tests.

Remove these extras. Some needed to be signed-olny, and there were some
possible but unrequired _x variants that needed an extra argument to
IntrinsicMX to allow [de-]selection at compile-time.

Reviewers: simon_tatham

Subscribers: kristof.beyls, dmgreen, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71466

Added: 
    

Modified: 
    clang/include/clang/Basic/arm_mve.td
    clang/include/clang/Basic/arm_mve_defs.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/arm_mve.td b/clang/include/clang/Basic/arm_mve.td
index 6a27bdb807a9..15ed4ce83f01 100644
--- a/clang/include/clang/Basic/arm_mve.td
+++ b/clang/include/clang/Basic/arm_mve.td
@@ -79,10 +79,6 @@ def vmulhq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
                               (IRInt<"vmulh", [Vector]> $a, $b)>;
 def vrmulhq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
                                (IRInt<"vrmulh", [Vector]> $a, $b)>;
-def vqdmulhq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
-                                (IRInt<"vqdmulh", [Vector]> $a, $b)>;
-def vqrdmulhq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
-                                 (IRInt<"vqrdmulh", [Vector]> $a, $b)>;
 def vmullbq_int: Intrinsic<DblVector, (args Vector:$a, Vector:$b),
                                       (IRInt<"vmull", [DblVector, Vector]>
                                        $a, $b, 0)>;
@@ -90,6 +86,12 @@ def vmulltq_int: Intrinsic<DblVector, (args Vector:$a, Vector:$b),
                                       (IRInt<"vmull", [DblVector, Vector]>
                                        $a, $b, 1)>;
 }
+let params = T.Signed in {
+def vqdmulhq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
+                                (IRInt<"vqdmulh", [Vector]> $a, $b)>;
+def vqrdmulhq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
+                                 (IRInt<"vqrdmulh", [Vector]> $a, $b)>;
+}
 
 let params = T.Poly, overrideKindLetter = "p" in {
 def vmullbq_poly: Intrinsic<DblVector, (args Vector:$a, Vector:$b),
@@ -135,11 +137,12 @@ def vabdq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
                              (IRInt<"vabd", [Vector]> $a, $b)>;
 }
 
-multiclass VectorVectorArithmetic<string operation> {
+multiclass VectorVectorArithmetic<string operation, int wantXVariant = 1> {
   defm "" : IntrinsicMX<Vector, (args Vector:$a, Vector:$b,
                                  Predicate:$pred),
                                 (IRInt<operation, [Vector, Predicate]> $a, $b,
-                                 $pred, $inactive)>;
+                                 $pred, $inactive),
+                                wantXVariant>;
 }
 
 multiclass VectorVectorArithmeticBitcast<string operation> {
@@ -179,16 +182,18 @@ let params = T.Int in {
   defm vmaxq : VectorVectorArithmetic<"max_predicated">;
   defm vmulhq : VectorVectorArithmetic<"mulh_predicated">;
   defm vrmulhq : VectorVectorArithmetic<"rmulh_predicated">;
-  defm vqdmulhq : VectorVectorArithmetic<"qdmulh_predicated">;
-  defm vqrdmulhq : VectorVectorArithmetic<"qrdmulh_predicated">;
-  defm vqaddq : VectorVectorArithmetic<"qadd_predicated">;
+  defm vqaddq : VectorVectorArithmetic<"qadd_predicated", 0>;
   defm vhaddq : VectorVectorArithmetic<"hadd_predicated">;
   defm vrhaddq : VectorVectorArithmetic<"rhadd_predicated">;
-  defm vqsubq : VectorVectorArithmetic<"qsub_predicated">;
+  defm vqsubq : VectorVectorArithmetic<"qsub_predicated", 0>;
   defm vhsubq : VectorVectorArithmetic<"hsub_predicated">;
   defm vmullbq_int : DblVectorVectorArithmetic<"mull_int_predicated", (u32 0)>;
   defm vmulltq_int : DblVectorVectorArithmetic<"mull_int_predicated", (u32 1)>;
 }
+let params = T.Signed in {
+  defm vqdmulhq : VectorVectorArithmetic<"qdmulh_predicated", 0>;
+  defm vqrdmulhq : VectorVectorArithmetic<"qrdmulh_predicated", 0>;
+}
 
 let params = T.Poly, overrideKindLetter = "p" in {
   defm vmullbq_poly : DblVectorVectorArithmetic<"mull_poly_predicated", (u32 0)>;
@@ -594,7 +599,7 @@ let params = T.Int in {
   defm vshlq: IntrinsicMX<Vector, (args Vector:$v, imm_0toNm1:$sh,
                                         Predicate:$pred),
       (IRInt<"shl_imm_predicated", [Vector, Predicate]>
-           $v, $sh, $pred, $inactive), "_n">;
+           $v, $sh, $pred, $inactive), 1, "_n">;
 
   let pnt = PNT_NType in {
     def vshrq_n: Intrinsic<Vector, (args Vector:$v, imm_1toN:$sh),
@@ -602,7 +607,7 @@ let params = T.Int in {
     defm vshrq: IntrinsicMX<Vector, (args Vector:$v, imm_1toN:$sh,
                                           Predicate:$pred),
         (IRInt<"shr_imm_predicated", [Vector, Predicate]>
-             $v, $sh, (unsignedflag Scalar), $pred, $inactive), "_n">;
+             $v, $sh, (unsignedflag Scalar), $pred, $inactive), 1, "_n">;
   }
 }
 

diff  --git a/clang/include/clang/Basic/arm_mve_defs.td b/clang/include/clang/Basic/arm_mve_defs.td
index 03472fb47b6c..939d5eb0cd6b 100644
--- a/clang/include/clang/Basic/arm_mve_defs.td
+++ b/clang/include/clang/Basic/arm_mve_defs.td
@@ -440,6 +440,7 @@ class NameOverride<string basename_> {
 // A wrapper to define both _m and _x versions of a predicated
 // intrinsic.
 multiclass IntrinsicMX<Type rettype, dag arguments, dag cg,
+                       int wantXVariant = 1,
                        string nameSuffix = "",
                        PolymorphicNameType pnt_x = PNT_Type> {
   // The _m variant takes an initial parameter called $inactive, which
@@ -449,15 +450,17 @@ multiclass IntrinsicMX<Type rettype, dag arguments, dag cg,
   def "_m" # nameSuffix:
      Intrinsic<rettype, !con((args rettype:$inactive), arguments), cg>;
 
-  // The _x variant leaves off that parameter, and simply uses an
-  // undef value of the same type.
-  def "_x" # nameSuffix:
-     Intrinsic<rettype, arguments, (seq (undef rettype):$inactive, cg)> {
-    // Allow overriding of the polymorphic name type, because
-    // sometimes the _m and _x variants polymorph 
diff erently
-    // (typically because the type of the inactive parameter can be
-    // used as a disambiguator if it's present).
-    let pnt = pnt_x;
+  foreach unusedVar = !if(!eq(wantXVariant, 1), [1], []<int>) in {
+    // The _x variant leaves off that parameter, and simply uses an
+    // undef value of the same type.
+    def "_x" # nameSuffix:
+       Intrinsic<rettype, arguments, (seq (undef rettype):$inactive, cg)> {
+      // Allow overriding of the polymorphic name type, because
+      // sometimes the _m and _x variants polymorph 
diff erently
+      // (typically because the type of the inactive parameter can be
+      // used as a disambiguator if it's present).
+      let pnt = pnt_x;
+    }
   }
 }
 


        


More information about the cfe-commits mailing list