[ARM][MVE][Intrinsics] remove extraneous intrinsics. (Reapply)
authorMark Murray <mark.murray@arm.com>
Fri, 13 Dec 2019 16:36:08 +0000 (16:36 +0000)
committerMark Murray <mark.murray@arm.com>
Fri, 13 Dec 2019 16:37:02 +0000 (16:37 +0000)
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

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

index 6a27bdb..061759a 100644 (file)
@@ -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">;
   }
 }
 
@@ -620,7 +625,7 @@ let params = T.Int in {
     defm vrshrq: IntrinsicMX<Vector, (args Vector:$v, imm_1toN:$sh,
                                            Predicate:$pred),
          (IRInt<"vrshr_imm_predicated", [Vector, Predicate]>
-              $v, $sh, (unsignedflag Scalar), $pred, $inactive), "_n">;
+              $v, $sh, (unsignedflag Scalar), $pred, $inactive), 1, "_n">;
   }
 }
 
@@ -641,7 +646,7 @@ multiclass vshll_imm<int top> {
     defm "": IntrinsicMX<DblVector, (args Vector:$v, imm_1toN:$sh,
                                           Predicate:$pred),
         (IRInt<"vshll_imm_predicated", [DblVector, Vector, Predicate]>
-            $v, $sh, (unsignedflag Scalar), top, $pred, $inactive), "_n">;
+            $v, $sh, (unsignedflag Scalar), top, $pred, $inactive), 1, "_n">;
   }
 }
 defm vshllbq : vshll_imm<0>;
index 03472fb..939d5eb 100644 (file)
@@ -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 differently
-    // (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 differently
+      // (typically because the type of the inactive parameter can be
+      // used as a disambiguator if it's present).
+      let pnt = pnt_x;
+    }
   }
 }