[PATCH] D100687: [Hexagon] Use 'not' instead of 'vnot' in patterns with vectors.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 16 14:28:38 PDT 2021
craig.topper created this revision.
craig.topper added a reviewer: kparzysz.
Herald added a subscriber: hiraditya.
craig.topper requested review of this revision.
Herald added a project: LLVM.
'not' expands to checking for an xor with a -1 constant. Since
this looks for a ConstantSDNode it will never match for a vector.
'vnot' expands to immAllOnesV.
It doesn't look like there is any coverage for these instructions
since no test failed. I even tried removing some of the patterns
completely in case I was wrong about -1 not working and still
nothing failed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100687
Files:
llvm/lib/Target/Hexagon/HexagonPatterns.td
llvm/lib/Target/Hexagon/HexagonPatternsHVX.td
Index: llvm/lib/Target/Hexagon/HexagonPatternsHVX.td
===================================================================
--- llvm/lib/Target/Hexagon/HexagonPatternsHVX.td
+++ llvm/lib/Target/Hexagon/HexagonPatternsHVX.td
@@ -576,12 +576,12 @@
def: OpR_RR_pat<V6_pred_xor, Xor, VecQ16, HQ16>;
def: OpR_RR_pat<V6_pred_xor, Xor, VecQ32, HQ32>;
- def: OpR_RR_pat<V6_pred_and_n, Not2<And>, VecQ8, HQ8>;
- def: OpR_RR_pat<V6_pred_and_n, Not2<And>, VecQ16, HQ16>;
- def: OpR_RR_pat<V6_pred_and_n, Not2<And>, VecQ32, HQ32>;
- def: OpR_RR_pat<V6_pred_or_n, Not2<Or>, VecQ8, HQ8>;
- def: OpR_RR_pat<V6_pred_or_n, Not2<Or>, VecQ16, HQ16>;
- def: OpR_RR_pat<V6_pred_or_n, Not2<Or>, VecQ32, HQ32>;
+ def: OpR_RR_pat<V6_pred_and_n, VNot2<And>, VecQ8, HQ8>;
+ def: OpR_RR_pat<V6_pred_and_n, VNot2<And>, VecQ16, HQ16>;
+ def: OpR_RR_pat<V6_pred_and_n, VNot2<And>, VecQ32, HQ32>;
+ def: OpR_RR_pat<V6_pred_or_n, VNot2<Or>, VecQ8, HQ8>;
+ def: OpR_RR_pat<V6_pred_or_n, VNot2<Or>, VecQ16, HQ16>;
+ def: OpR_RR_pat<V6_pred_or_n, VNot2<Or>, VecQ32, HQ32>;
def: OpR_RR_pat<V6_veqb, seteq, VecQ8, HVI8>;
def: OpR_RR_pat<V6_veqh, seteq, VecQ16, HVI16>;
Index: llvm/lib/Target/Hexagon/HexagonPatterns.td
===================================================================
--- llvm/lib/Target/Hexagon/HexagonPatterns.td
+++ llvm/lib/Target/Hexagon/HexagonPatterns.td
@@ -293,6 +293,8 @@
class Not2<PatFrag P>
: PatFrag<(ops node:$A, node:$B), (P node:$A, (not node:$B))>;
+class VNot2<PatFrag P>
+ : PatFrag<(ops node:$A, node:$B), (P node:$A, (vnot node:$B))>;
// If there is a constant operand that feeds the and/or instruction,
// do not generate the compound instructions.
@@ -564,25 +566,25 @@
def: Pat<(pnot V8I1:$Ps), (C2_not V8I1:$Ps)>;
def: Pat<(add I1:$Ps, -1), (C2_not I1:$Ps)>;
-multiclass BoolOpR_RR_pat<InstHexagon MI, PatFrag Op> {
+multiclass BoolOpR_RR_pat<InstHexagon MI, PatFrag Op, PatFrag VOp = Op> {
def: OpR_RR_pat<MI, Op, i1, I1>;
- def: OpR_RR_pat<MI, Op, v2i1, V2I1>;
- def: OpR_RR_pat<MI, Op, v4i1, V4I1>;
- def: OpR_RR_pat<MI, Op, v8i1, V8I1>;
+ def: OpR_RR_pat<MI, VOp, v2i1, V2I1>;
+ def: OpR_RR_pat<MI, VOp, v4i1, V4I1>;
+ def: OpR_RR_pat<MI, VOp, v8i1, V8I1>;
}
-multiclass BoolAccRRR_pat<InstHexagon MI, PatFrag AccOp, PatFrag Op> {
- def: AccRRR_pat<MI, AccOp, Op, I1, I1, I1>;
- def: AccRRR_pat<MI, AccOp, Op, V2I1, V2I1, V2I1>;
- def: AccRRR_pat<MI, AccOp, Op, V4I1, V4I1, V4I1>;
- def: AccRRR_pat<MI, AccOp, Op, V8I1, V8I1, V8I1>;
+multiclass BoolAccRRR_pat<InstHexagon MI, PatFrag AccOp, PatFrag Op, PatFrag VOp = Op> {
+ def: AccRRR_pat<MI, AccOp, Op, I1, I1, I1>;
+ def: AccRRR_pat<MI, AccOp, VOp, V2I1, V2I1, V2I1>;
+ def: AccRRR_pat<MI, AccOp, VOp, V4I1, V4I1, V4I1>;
+ def: AccRRR_pat<MI, AccOp, VOp, V8I1, V8I1, V8I1>;
}
defm: BoolOpR_RR_pat<C2_and, And>;
defm: BoolOpR_RR_pat<C2_or, Or>;
defm: BoolOpR_RR_pat<C2_xor, Xor>;
-defm: BoolOpR_RR_pat<C2_andn, Not2<And>>;
-defm: BoolOpR_RR_pat<C2_orn, Not2<Or>>;
+defm: BoolOpR_RR_pat<C2_andn, Not2<And>, VNot2<And>>;
+defm: BoolOpR_RR_pat<C2_orn, Not2<Or>, VNot2<Or>>;
// op(Ps, op(Pt, Pu))
defm: BoolAccRRR_pat<C4_and_and, And, Su<And>>;
@@ -591,10 +593,10 @@
defm: BoolAccRRR_pat<C4_or_or, Or, Su<Or>>;
// op(Ps, op(Pt, ~Pu))
-defm: BoolAccRRR_pat<C4_and_andn, And, Su<Not2<And>>>;
-defm: BoolAccRRR_pat<C4_and_orn, And, Su<Not2<Or>>>;
-defm: BoolAccRRR_pat<C4_or_andn, Or, Su<Not2<And>>>;
-defm: BoolAccRRR_pat<C4_or_orn, Or, Su<Not2<Or>>>;
+defm: BoolAccRRR_pat<C4_and_andn, And, Su<Not2<And>>, Su<VNot2<And>>>;
+defm: BoolAccRRR_pat<C4_and_orn, And, Su<Not2<Or>>, Su<VNot2<Or>>>;
+defm: BoolAccRRR_pat<C4_or_andn, Or, Su<Not2<And>>, Su<VNot2<And>>>;
+defm: BoolAccRRR_pat<C4_or_orn, Or, Su<Not2<Or>>, Su<VNot2<Or>>>;
// --(5) Compare ---------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100687.338237.patch
Type: text/x-patch
Size: 3981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210416/acf1f70e/attachment.bin>
More information about the llvm-commits
mailing list