Skip to content

Commit

Permalink
[AArch64-SVE]: Force generating code compatible to streaming mode.
Browse files Browse the repository at this point in the history
When streaming mode is enabled, custom-lower arithmetic and logical fixed-width vector ops;
to force generateing code compatible to streaming mode.

Differential Revision: https://reviews.llvm.org/D135324
  • Loading branch information
hassnaaHamdi committed Nov 10, 2022
1 parent 06a7e04 commit 9564897
Show file tree
Hide file tree
Showing 6 changed files with 3,675 additions and 4 deletions.
18 changes: 14 additions & 4 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Expand Up @@ -1393,7 +1393,7 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,

if (Subtarget->forceStreamingCompatibleSVE()) {
for (MVT VT : {MVT::v8i8, MVT::v16i8, MVT::v4i16, MVT::v8i16, MVT::v2i32,
MVT::v4i32, MVT::v2i64})
MVT::v4i32, MVT::v1i64, MVT::v2i64})
addTypeForStreamingSVE(VT);

for (MVT VT :
Expand Down Expand Up @@ -1613,6 +1613,13 @@ void AArch64TargetLowering::addTypeForStreamingSVE(MVT VT) {
setOperationAction(ISD::SIGN_EXTEND, VT, Custom);
setOperationAction(ISD::CONCAT_VECTORS, VT, Custom);
setOperationAction(ISD::AND, VT, Custom);
setOperationAction(ISD::ADD, VT, Custom);
setOperationAction(ISD::SUB, VT, Custom);
setOperationAction(ISD::MUL, VT, Custom);
setOperationAction(ISD::MULHS, VT, Custom);
setOperationAction(ISD::MULHU, VT, Custom);
setOperationAction(ISD::ABS, VT, Custom);
setOperationAction(ISD::XOR, VT, Custom);
}

void AArch64TargetLowering::addTypeForFixedLengthSVE(MVT VT) {
Expand Down Expand Up @@ -3543,7 +3550,8 @@ getAArch64XALUOOp(AArch64CC::CondCode &CC, SDValue Op, SelectionDAG &DAG) {
}

SDValue AArch64TargetLowering::LowerXOR(SDValue Op, SelectionDAG &DAG) const {
if (useSVEForFixedLengthVectorVT(Op.getValueType()))
if (useSVEForFixedLengthVectorVT(Op.getValueType(),
Subtarget->forceStreamingCompatibleSVE()))
return LowerToScalableOp(Op, DAG);

SDValue Sel = Op.getOperand(0);
Expand Down Expand Up @@ -4455,7 +4463,8 @@ SDValue AArch64TargetLowering::LowerMUL(SDValue Op, SelectionDAG &DAG) const {
EVT VT = Op.getValueType();

// If SVE is available then i64 vector multiplications can also be made legal.
bool OverrideNEON = VT == MVT::v2i64 || VT == MVT::v1i64;
bool OverrideNEON = VT == MVT::v2i64 || VT == MVT::v1i64 ||
Subtarget->forceStreamingCompatibleSVE();

if (VT.isScalableVector() || useSVEForFixedLengthVectorVT(VT, OverrideNEON))
return LowerToPredicatedOp(Op, DAG, AArch64ISD::MUL_PRED);
Expand Down Expand Up @@ -11705,7 +11714,8 @@ static SDValue tryLowerToSLI(SDNode *N, SelectionDAG &DAG) {

SDValue AArch64TargetLowering::LowerVectorOR(SDValue Op,
SelectionDAG &DAG) const {
if (useSVEForFixedLengthVectorVT(Op.getValueType()))
if (useSVEForFixedLengthVectorVT(Op.getValueType(),
Subtarget->forceStreamingCompatibleSVE()))
return LowerToScalableOp(Op, DAG);

// Attempt to form a vector S[LR]I from (or (and X, C1), (lsl Y, C2))
Expand Down

0 comments on commit 9564897

Please sign in to comment.