@@ -13597,17 +13597,27 @@ struct NodeExtensionHelper {
13597
13597
case RISCVISD::VSEXT_VL:
13598
13598
case RISCVISD::VZEXT_VL:
13599
13599
case RISCVISD::FP_EXTEND_VL:
13600
- case ISD::SPLAT_VECTOR:
13601
13600
return OrigOperand.getOperand(0);
13601
+ case ISD::SPLAT_VECTOR: {
13602
+ SDValue Op = OrigOperand.getOperand(0);
13603
+ unsigned Opc = Op.getOpcode();
13604
+ if (SupportsSExt && Opc == ISD::SIGN_EXTEND_INREG)
13605
+ return Op.getOperand(0);
13606
+
13607
+ if (SupportsZExt && Opc == ISD::AND)
13608
+ return Op.getOperand(0);
13609
+
13610
+ return Op;
13611
+ }
13602
13612
default:
13603
13613
return OrigOperand;
13604
13614
}
13605
13615
}
13606
13616
13607
13617
/// Check if this instance represents a splat.
13608
13618
bool isSplat() const {
13609
- return (OrigOperand.getOpcode() == RISCVISD::VMV_V_X_VL) ||
13610
- ( OrigOperand.getOpcode() == ISD::SPLAT_VECTOR);
13619
+ return (OrigOperand.getOpcode() == RISCVISD::VMV_V_X_VL ||
13620
+ OrigOperand.getOpcode() == ISD::SPLAT_VECTOR);
13611
13621
}
13612
13622
13613
13623
/// Get the extended opcode.
@@ -13652,7 +13662,7 @@ struct NodeExtensionHelper {
13652
13662
case RISCVISD::FP_EXTEND_VL:
13653
13663
return DAG.getNode(ExtOpc, DL, NarrowVT, Source, Mask, VL);
13654
13664
case ISD::SPLAT_VECTOR:
13655
- return DAG.getSplat(NarrowVT, DL, Source.getOperand(0) );
13665
+ return DAG.getSplat(NarrowVT, DL, Source);
13656
13666
case RISCVISD::VMV_V_X_VL:
13657
13667
return DAG.getNode(RISCVISD::VMV_V_X_VL, DL, NarrowVT,
13658
13668
DAG.getUNDEF(NarrowVT), Source.getOperand(1), VL);
0 commit comments