Skip to content

Commit 12c2a53

Browse files
authored
[AMDGPU] Simplify some uniform patterns. NFC. (#85407)
If the outer node is uniform then the inner nodes must be too, so there is no need to check them explicitly.
1 parent fc06c8e commit 12c2a53

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

llvm/lib/Target/AMDGPU/SOPInstructions.td

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -744,19 +744,19 @@ def S_NOR_B64 : SOP2_64 <"s_nor_b64",
744744

745745
// There are also separate patterns for types other than i32
746746
def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32",
747-
[(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
747+
[(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (not i32:$src1)))]
748748
>;
749749

750750
def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64",
751-
[(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
751+
[(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (not i64:$src1)))]
752752
>;
753753

754754
def S_ORN2_B32 : SOP2_32 <"s_orn2_b32",
755-
[(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))]
755+
[(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (not i32:$src1)))]
756756
>;
757757

758758
def S_ORN2_B64 : SOP2_64 <"s_orn2_b64",
759-
[(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))]
759+
[(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (not i64:$src1)))]
760760
>;
761761
} // End Defs = [SCC]
762762

@@ -1905,21 +1905,20 @@ def : GCNPat<
19051905
(S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src)
19061906
>;
19071907

1908-
// FIXME: ValueType should have isVector field
19091908
class ScalarNot2Pat<Instruction inst, SDPatternOperator op, ValueType vt,
1910-
bit isVector = 1> : GCNPat<
1911-
(UniformBinFrag<op> vt:$src0, (UniformUnaryFrag<!if(isVector, vnot, not)> vt:$src1)),
1909+
SDPatternOperator notnode = !if(vt.isVector, vnot, not)> : GCNPat<
1910+
(UniformBinFrag<op> vt:$src0, (notnode vt:$src1)),
19121911
(inst getSOPSrcForVT<vt>.ret:$src0, getSOPSrcForVT<vt>.ret:$src1)
19131912
>;
19141913

19151914
// Match these for some more types
19161915
// TODO: i1
1917-
def : ScalarNot2Pat<S_ANDN2_B32, and, i16, 0>;
1916+
def : ScalarNot2Pat<S_ANDN2_B32, and, i16>;
19181917
def : ScalarNot2Pat<S_ANDN2_B32, and, v2i16>;
19191918
def : ScalarNot2Pat<S_ANDN2_B64, and, v4i16>;
19201919
def : ScalarNot2Pat<S_ANDN2_B64, and, v2i32>;
19211920

1922-
def : ScalarNot2Pat<S_ORN2_B32, or, i16, 0>;
1921+
def : ScalarNot2Pat<S_ORN2_B32, or, i16>;
19231922
def : ScalarNot2Pat<S_ORN2_B32, or, v2i16>;
19241923
def : ScalarNot2Pat<S_ORN2_B64, or, v4i16>;
19251924
def : ScalarNot2Pat<S_ORN2_B64, or, v2i32>;

0 commit comments

Comments
 (0)