Skip to content

Commit d5488f1

Browse files
authored
[AArch64] Combine separate vector and scalar tablegen SDNode record for AArch64ISD::REV16. NFC (#125614)
Relax the SDTypeProfile for AArch64ISD::REV32/REV64 to remove the requirement that the type be vector. It's not a good idea to have two different SDNode records with different SDTypeProfiles. SDTypeProfiles are used to remove some unneeded checks from the GenDAGISel.inc. Having different SDTypeProfiles can cause checks to be removed that can create ambiguous matches, but that did not happen in this case. With this change the AArchGenDAGISel.inc is identical. The only change is AArch64GenGlobalISel.inc which now includes scalar patterns for G_REV16 due to them now being picks up by an SDNodeEquiv. GISel does not yet use G_REV16 for scalars so this is not a functional change.
1 parent fe7e280 commit d5488f1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.td

+6-8
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ def SDT_AArch64cbz : SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisVT<1, OtherVT>]>;
428428
def SDT_AArch64tbz : SDTypeProfile<0, 3, [SDTCisInt<0>, SDTCisInt<1>,
429429
SDTCisVT<2, OtherVT>]>;
430430

431-
432431
def SDT_AArch64CSel : SDTypeProfile<1, 4,
433432
[SDTCisSameAs<0, 1>,
434433
SDTCisSameAs<0, 2>,
@@ -451,6 +450,7 @@ def SDT_AArch64FCCMP : SDTypeProfile<1, 5,
451450
def SDT_AArch64FCmp : SDTypeProfile<1, 2, [SDTCisVT<0, i32>,
452451
SDTCisFP<1>,
453452
SDTCisSameAs<2, 1>]>;
453+
def SDT_AArch64Rev : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>]>;
454454
def SDT_AArch64Dup : SDTypeProfile<1, 1, [SDTCisVec<0>]>;
455455
def SDT_AArch64DupLane : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisInt<2>]>;
456456
def SDT_AArch64Insr : SDTypeProfile<1, 2, [SDTCisVec<0>]>;
@@ -817,11 +817,9 @@ def AArch64mvni_msl : SDNode<"AArch64ISD::MVNImsl", SDT_AArch64MOVIshift>;
817817
def AArch64movi : SDNode<"AArch64ISD::MOVI", SDT_AArch64MOVIedit>;
818818
def AArch64fmov : SDNode<"AArch64ISD::FMOV", SDT_AArch64MOVIedit>;
819819

820-
def AArch64rev16_scalar : SDNode<"AArch64ISD::REV16", SDTIntUnaryOp>;
821-
822-
def AArch64rev16 : SDNode<"AArch64ISD::REV16", SDT_AArch64UnaryVec>;
823-
def AArch64rev32 : SDNode<"AArch64ISD::REV32", SDT_AArch64UnaryVec>;
824-
def AArch64rev64 : SDNode<"AArch64ISD::REV64", SDT_AArch64UnaryVec>;
820+
def AArch64rev16 : SDNode<"AArch64ISD::REV16", SDT_AArch64Rev>;
821+
def AArch64rev32 : SDNode<"AArch64ISD::REV32", SDT_AArch64Rev>;
822+
def AArch64rev64 : SDNode<"AArch64ISD::REV64", SDT_AArch64Rev>;
825823
def AArch64ext : SDNode<"AArch64ISD::EXT", SDT_AArch64ExtVec>;
826824

827825
def AArch64vashr : SDNode<"AArch64ISD::VASHR", SDT_AArch64vshift>;
@@ -3000,8 +2998,8 @@ def : Pat<(bswap (rotr GPR64:$Rn, (i64 32))), (REV32Xr GPR64:$Rn)>;
30002998
def : Pat<(srl (bswap top16Zero:$Rn), (i64 16)), (REV16Wr GPR32:$Rn)>;
30012999
def : Pat<(srl (bswap top32Zero:$Rn), (i64 32)), (REV32Xr GPR64:$Rn)>;
30023000

3003-
def : Pat<(AArch64rev16_scalar GPR32:$Rn), (REV16Wr GPR32:$Rn)>;
3004-
def : Pat<(AArch64rev16_scalar GPR64:$Rn), (REV16Xr GPR64:$Rn)>;
3001+
def : Pat<(AArch64rev16 GPR32:$Rn), (REV16Wr GPR32:$Rn)>;
3002+
def : Pat<(AArch64rev16 GPR64:$Rn), (REV16Xr GPR64:$Rn)>;
30053003

30063004
def : Pat<(or (and (srl GPR64:$Rn, (i64 8)), (i64 0x00ff00ff00ff00ff)),
30073005
(and (shl GPR64:$Rn, (i64 8)), (i64 0xff00ff00ff00ff00))),

0 commit comments

Comments
 (0)