[llvm] [AMDGPU] Simplify some uniform patterns. NFC. (PR #85407)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 07:57:31 PDT 2024
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/85407
If the outer node is uniform then the inner nodes must be too, so there
is no need to check them explicitly.
>From 679df327391e114b09d069c254a22a9ac3e78e0e Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Fri, 15 Mar 2024 14:48:09 +0000
Subject: [PATCH] [AMDGPU] Simplify some uniform patterns. NFC.
If the outer node is uniform then the inner nodes must be too, so there
is no need to check them explicitly.
---
llvm/lib/Target/AMDGPU/SOPInstructions.td | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td
index bccdf4b5ca6374..1159c4e0fc2ed5 100644
--- a/llvm/lib/Target/AMDGPU/SOPInstructions.td
+++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td
@@ -744,19 +744,19 @@ def S_NOR_B64 : SOP2_64 <"s_nor_b64",
// There are also separate patterns for types other than i32
def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32",
- [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
+ [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (not i32:$src1)))]
>;
def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64",
- [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
+ [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (not i64:$src1)))]
>;
def S_ORN2_B32 : SOP2_32 <"s_orn2_b32",
- [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
+ [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (not i32:$src1)))]
>;
def S_ORN2_B64 : SOP2_64 <"s_orn2_b64",
- [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
+ [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (not i64:$src1)))]
>;
} // End Defs = [SCC]
@@ -1905,21 +1905,20 @@ def : GCNPat<
(S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
>;
-// FIXME: ValueType should have isVector field
class ScalarNot2Pat<Instruction inst, SDPatternOperator op, ValueType vt,
- bit isVector = 1> : GCNPat<
- (UniformBinFrag<op> vt:$src0, (UniformUnaryFrag<!if(isVector, vnot, not)> vt:$src1)),
+ SDPatternOperator notnode = !if(vt.isVector, vnot, not)> : GCNPat<
+ (UniformBinFrag<op> vt:$src0, (notnode vt:$src1)),
(inst getSOPSrcForVT<vt>.ret:$src0, getSOPSrcForVT<vt>.ret:$src1)
>;
// Match these for some more types
// TODO: i1
-def : ScalarNot2Pat<S_ANDN2_B32, and, i16, 0>;
+def : ScalarNot2Pat<S_ANDN2_B32, and, i16>;
def : ScalarNot2Pat<S_ANDN2_B32, and, v2i16>;
def : ScalarNot2Pat<S_ANDN2_B64, and, v4i16>;
def : ScalarNot2Pat<S_ANDN2_B64, and, v2i32>;
-def : ScalarNot2Pat<S_ORN2_B32, or, i16, 0>;
+def : ScalarNot2Pat<S_ORN2_B32, or, i16>;
def : ScalarNot2Pat<S_ORN2_B32, or, v2i16>;
def : ScalarNot2Pat<S_ORN2_B64, or, v4i16>;
def : ScalarNot2Pat<S_ORN2_B64, or, v2i32>;
More information about the llvm-commits
mailing list