Skip to content

Commit 732eb54

Browse files
authored
[AArch64] Replace SIMDLongThreeVectorBHSabd with SIMDLongThreeVectorBHS. (#152987)
We just need to use a BinOpFrag to share the patterns. This also moves UABDL to where it belongs in with similar instructions, and removes some patterns that are now handled by abd nodes. This is mostly NFC except for GISel, which will catch back up when it handles abd nodes in the same way.
1 parent 2ed727f commit 732eb54

File tree

2 files changed

+4
-60
lines changed

2 files changed

+4
-60
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7405,44 +7405,6 @@ multiclass SIMDLongThreeVectorHS<bit U, bits<4> opc, string asm,
74057405
(extract_high_v4i32 (v4i32 V128:$Rm))))]>;
74067406
}
74077407

7408-
let isCommutable = 1 in
7409-
multiclass SIMDLongThreeVectorBHSabdl<bit U, bits<4> opc, string asm,
7410-
SDPatternOperator OpNode = null_frag> {
7411-
def v8i8_v8i16 : BaseSIMDDifferentThreeVector<U, 0b000, opc,
7412-
V128, V64, V64,
7413-
asm, ".8h", ".8b", ".8b",
7414-
[(set (v8i16 V128:$Rd),
7415-
(zext (v8i8 (OpNode (v8i8 V64:$Rn), (v8i8 V64:$Rm)))))]>;
7416-
def v16i8_v8i16 : BaseSIMDDifferentThreeVector<U, 0b001, opc,
7417-
V128, V128, V128,
7418-
asm#"2", ".8h", ".16b", ".16b",
7419-
[(set (v8i16 V128:$Rd),
7420-
(zext (v8i8 (OpNode (extract_high_v16i8 (v16i8 V128:$Rn)),
7421-
(extract_high_v16i8 (v16i8 V128:$Rm))))))]>;
7422-
def v4i16_v4i32 : BaseSIMDDifferentThreeVector<U, 0b010, opc,
7423-
V128, V64, V64,
7424-
asm, ".4s", ".4h", ".4h",
7425-
[(set (v4i32 V128:$Rd),
7426-
(zext (v4i16 (OpNode (v4i16 V64:$Rn), (v4i16 V64:$Rm)))))]>;
7427-
def v8i16_v4i32 : BaseSIMDDifferentThreeVector<U, 0b011, opc,
7428-
V128, V128, V128,
7429-
asm#"2", ".4s", ".8h", ".8h",
7430-
[(set (v4i32 V128:$Rd),
7431-
(zext (v4i16 (OpNode (extract_high_v8i16 (v8i16 V128:$Rn)),
7432-
(extract_high_v8i16 (v8i16 V128:$Rm))))))]>;
7433-
def v2i32_v2i64 : BaseSIMDDifferentThreeVector<U, 0b100, opc,
7434-
V128, V64, V64,
7435-
asm, ".2d", ".2s", ".2s",
7436-
[(set (v2i64 V128:$Rd),
7437-
(zext (v2i32 (OpNode (v2i32 V64:$Rn), (v2i32 V64:$Rm)))))]>;
7438-
def v4i32_v2i64 : BaseSIMDDifferentThreeVector<U, 0b101, opc,
7439-
V128, V128, V128,
7440-
asm#"2", ".2d", ".4s", ".4s",
7441-
[(set (v2i64 V128:$Rd),
7442-
(zext (v2i32 (OpNode (extract_high_v4i32 (v4i32 V128:$Rn)),
7443-
(extract_high_v4i32 (v4i32 V128:$Rm))))))]>;
7444-
}
7445-
74467408
multiclass SIMDLongThreeVectorTiedBHSabal<bit U, bits<4> opc,
74477409
string asm,
74487410
SDPatternOperator OpNode> {

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5707,27 +5707,6 @@ let Predicates = [HasFullFP16] in {
57075707
// Advanced SIMD two vector instructions.
57085708
//===----------------------------------------------------------------------===//
57095709

5710-
defm UABDL : SIMDLongThreeVectorBHSabdl<1, 0b0111, "uabdl", abdu>;
5711-
// Match UABDL in log2-shuffle patterns.
5712-
def : Pat<(abs (v8i16 (sub (zext (v8i8 V64:$opA)),
5713-
(zext (v8i8 V64:$opB))))),
5714-
(UABDLv8i8_v8i16 V64:$opA, V64:$opB)>;
5715-
def : Pat<(abs (v8i16 (sub (zext (extract_high_v16i8 (v16i8 V128:$opA))),
5716-
(zext (extract_high_v16i8 (v16i8 V128:$opB)))))),
5717-
(UABDLv16i8_v8i16 V128:$opA, V128:$opB)>;
5718-
def : Pat<(abs (v4i32 (sub (zext (v4i16 V64:$opA)),
5719-
(zext (v4i16 V64:$opB))))),
5720-
(UABDLv4i16_v4i32 V64:$opA, V64:$opB)>;
5721-
def : Pat<(abs (v4i32 (sub (zext (extract_high_v8i16 (v8i16 V128:$opA))),
5722-
(zext (extract_high_v8i16 (v8i16 V128:$opB)))))),
5723-
(UABDLv8i16_v4i32 V128:$opA, V128:$opB)>;
5724-
def : Pat<(abs (v2i64 (sub (zext (v2i32 V64:$opA)),
5725-
(zext (v2i32 V64:$opB))))),
5726-
(UABDLv2i32_v2i64 V64:$opA, V64:$opB)>;
5727-
def : Pat<(abs (v2i64 (sub (zext (extract_high_v4i32 (v4i32 V128:$opA))),
5728-
(zext (extract_high_v4i32 (v4i32 V128:$opB)))))),
5729-
(UABDLv4i32_v2i64 V128:$opA, V128:$opB)>;
5730-
57315710
defm ABS : SIMDTwoVectorBHSD<0, 0b01011, "abs", abs>;
57325711
defm CLS : SIMDTwoVectorBHS<0, 0b00100, "cls", int_aarch64_neon_cls>;
57335712
defm CLZ : SIMDTwoVectorBHS<1, 0b00100, "clz", ctlz>;
@@ -6810,7 +6789,8 @@ defm RSUBHN : SIMDNarrowThreeVectorBHS<1,0b0110,"rsubhn",int_aarch64_neon_rsubhn
68106789
let isCommutable = 1 in
68116790
defm PMULL : SIMDDifferentThreeVectorBD<0,0b1110,"pmull", AArch64pmull>;
68126791
defm SABAL : SIMDLongThreeVectorTiedBHSabal<0,0b0101,"sabal", abds>;
6813-
defm SABDL : SIMDLongThreeVectorBHSabdl<0, 0b0111, "sabdl", abds>;
6792+
defm SABDL : SIMDLongThreeVectorBHS<0, 0b0111, "sabdl",
6793+
BinOpFrag<(zext (abds node:$LHS, node:$RHS))>>;
68146794
defm SADDL : SIMDLongThreeVectorBHS< 0, 0b0000, "saddl",
68156795
BinOpFrag<(add (sext node:$LHS), (sext node:$RHS))>>;
68166796
defm SADDW : SIMDWideThreeVectorBHS< 0, 0b0001, "saddw",
@@ -6830,6 +6810,8 @@ defm SSUBL : SIMDLongThreeVectorBHS<0, 0b0010, "ssubl",
68306810
defm SSUBW : SIMDWideThreeVectorBHS<0, 0b0011, "ssubw",
68316811
BinOpFrag<(sub node:$LHS, (sext node:$RHS))>>;
68326812
defm UABAL : SIMDLongThreeVectorTiedBHSabal<1, 0b0101, "uabal", abdu>;
6813+
defm UABDL : SIMDLongThreeVectorBHS<1, 0b0111, "uabdl",
6814+
BinOpFrag<(zext (abdu node:$LHS, node:$RHS))>>;
68336815
defm UADDL : SIMDLongThreeVectorBHS<1, 0b0000, "uaddl",
68346816
BinOpFrag<(add (zanyext node:$LHS), (zanyext node:$RHS))>>;
68356817
defm UADDW : SIMDWideThreeVectorBHS<1, 0b0001, "uaddw",

0 commit comments

Comments
 (0)