MarkMurrayARM created this revision.
MarkMurrayARM added a reviewer: simon_tatham.
Herald added subscribers: cfe-commits, dmgreen, kristof.beyls.
Herald added a project: clang.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71466
Files:
clang/include/clang/Basic/arm_mve.td
clang/include/clang/Basic/arm_mve_defs.td
Index: clang/include/clang/Basic/arm_mve_defs.td
===================================================================
--- clang/include/clang/Basic/arm_mve_defs.td
+++ clang/include/clang/Basic/arm_mve_defs.td
@@ -435,6 +435,7 @@
// 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
@@ -444,15 +445,17 @@
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;
+ }
}
}
Index: clang/include/clang/Basic/arm_mve.td
===================================================================
--- clang/include/clang/Basic/arm_mve.td
+++ clang/include/clang/Basic/arm_mve.td
@@ -79,10 +79,6 @@
(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 @@
(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 @@
(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 @@
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 @@
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 @@
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">;
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits