diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp --- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -231,6 +231,45 @@ return false; } + /// SelectDSForm - Returns true if address N can be represented by the + /// addressing mode of DSForm instructions (a base register, plus a signed + /// 16-bit displacement that is a multiple of 4. + bool SelectDSForm(SDNode *Parent, SDValue N, SDValue &Disp, SDValue &Base) { + return PPCLowering->SelectOptimalAddrMode(Parent, N, Disp, Base, *CurDAG, + Align(4)) == PPC::AM_DSForm; + } + + /// SelectDQForm - Returns true if address N can be represented by the + /// addressing mode of DQForm instructions (a base register, plus a signed + /// 16-bit displacement that is a multiple of 16. + bool SelectDQForm(SDNode *Parent, SDValue N, SDValue &Disp, SDValue &Base) { + return PPCLowering->SelectOptimalAddrMode(Parent, N, Disp, Base, *CurDAG, + Align(16)) == PPC::AM_DQForm; + } + + /// SelectDForm - Returns true if address N can be represented by + /// the addressing mode of DForm instructions (a base register, plus a + /// signed 16-bit immediate. + bool SelectDForm(SDNode *Parent, SDValue N, SDValue &Disp, SDValue &Base) { + return PPCLowering->SelectOptimalAddrMode(Parent, N, Disp, Base, *CurDAG, + None) == PPC::AM_DForm; + } + + /// SelectXForm - Returns true if address N can be represented by the + /// addressing mode of XForm instructions (an indexed [r+r] operation). + bool SelectXForm(SDNode *Parent, SDValue N, SDValue &Disp, SDValue &Base) { + return PPCLowering->SelectOptimalAddrMode(Parent, N, Disp, Base, *CurDAG, + None) == PPC::AM_XForm; + } + + /// SelectForceXForm - Given the specified address, force it to be + /// represented as an indexed [r+r] operation (an XForm instruction). + bool SelectForceXForm(SDNode *Parent, SDValue N, SDValue &Disp, + SDValue &Base) { + return PPCLowering->SelectForceXFormMode(N, Disp, Base, *CurDAG) == + PPC::AM_XForm; + } + /// SelectAddrIdx - Given the specified address, check to see if it can be /// represented as an indexed [r+r] operation. /// This is for xform instructions whose associated displacement form is D. diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h --- a/llvm/lib/Target/PowerPC/PPCISelLowering.h +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h @@ -667,10 +667,56 @@ /// amount, otherwise return -1. int isQVALIGNIShuffleMask(SDNode *N); + // Flags for computing the optimal addressing mode for loads and stores. + enum MemOpFlags { + MOF_None = 0, + + // Type extend type flags. + MOF_SExt = 1, + MOF_ZExt = 1 << 1, + MOF_NoExt = 1 << 2, + + // Address computation flags. + MOF_NotAdd = 1 << 5, + MOF_RPlusSImm16 = 1 << 6, + MOF_RPlusLo = 1 << 7, + MOF_RPlusSImm16Mult4 = 1 << 8, + MOF_RPlusSImm16Mult16 = 1 << 9, + MOF_RPlusSImm34 = 1 << 10, + MOF_RPlusR = 1 << 11, + MOF_PCRel = 1 << 12, + MOF_AddrIsSImm32 = 1 << 13, + + // The in-memory type. + MOF_SubWInt = 1 << 15, + MOF_WordInt = 1 << 16, + MOF_DWInt = 1 << 17, + MOF_ScalFlt = 1 << 18, + MOF_Vec = 1 << 19, + MOF_Vec256 = 1 << 20, + + // Subtarget features. + MOF_SubtargetNoP9 = 1 << 22, + MOF_SubtargetP9 = 1 << 23, + MOF_SubtargetP10 = 1 << 24, + MOF_SubtargetSPE = 1 << 25 + }; + + // The addressing modes for loads and stores. + enum AddrMode { + AM_None, + AM_DForm, + AM_DSForm, + AM_DQForm, + AM_XForm, + }; } // end namespace PPC class PPCTargetLowering : public TargetLowering { const PPCSubtarget &Subtarget; + // Map that relates a set of common address flags to PPC addressing modes. + std::map> AddrModesMap; + void initializeAddrModeMap(); public: explicit PPCTargetLowering(const PPCTargetMachine &TM, @@ -1036,6 +1082,27 @@ unsigned JTI, MCContext &Ctx) const override; + /// getAddrModeForFlags - Based on the set of address flags, select the most + /// optimal instruction format to match by. + PPC::AddrMode getAddrModeForFlags(unsigned Flags) const; + /// computeMOFlags - Given a node N and it's Parent (a MemSDNode), compute + /// the address flags of the load/store instruction that is to be matched. + /// The address flags are are stored in a map, which is then searched + /// through to determine the optimal load/store instruction format. + unsigned computeMOFlags(const SDNode *Parent, SDValue N, + SelectionDAG &DAG) const; + /// SelectOptimalAddrMode - Based on a node N and it's Parent (a MemSDNode), + /// compute the address flags of the node, get the optimal address mode + /// based on the flags, and set the Base and Disp based on the address mode. + PPC::AddrMode SelectOptimalAddrMode(const SDNode *Parent, SDValue N, + SDValue &Disp, SDValue &Base, + SelectionDAG &DAG, + MaybeAlign Align) const; + /// SelectForceXFormMode - Given the specified address, force it to be + /// represented as an indexed [r+r] operation (an XForm instruction). + PPC::AddrMode SelectForceXFormMode(SDValue N, SDValue &Disp, SDValue &Base, + SelectionDAG &DAG) const; + /// Structure that collects some common arguments that get passed around /// between the functions for call lowering. struct CallFlags { diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -141,6 +141,10 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM, const PPCSubtarget &STI) : TargetLowering(TM), Subtarget(STI) { + // Initialize map that relates the PPC addressing modes to the computed flags + // of a load/store instruction. The map is used to determine the optimal + // addressing mode when selecting load and stores. + initializeAddrModeMap(); // On PPC32/64, arguments smaller than 4/8 bytes are extended, so all // arguments are at least 4/8 bytes aligned. bool isPPC64 = Subtarget.isPPC64(); @@ -1410,6 +1414,50 @@ PredictableSelectIsExpensive = Subtarget.isPredictableSelectIsExpensive(); } +/// initializeAddrModeMap - Initialize the map that relates the different +/// instruction formats of load and store instructions to a set of flags. +/// This ensures the load/store instruction is correctly matched during +/// instruction selection. +void PPCTargetLowering::initializeAddrModeMap() { + AddrModesMap[PPC::AM_DForm] = { + PPC::MOF_ZExt | PPC::MOF_RPlusSImm16 | PPC::MOF_WordInt, + PPC::MOF_ZExt | PPC::MOF_RPlusSImm16 | PPC::MOF_SubWInt, + PPC::MOF_SExt | PPC::MOF_RPlusSImm16 | PPC::MOF_SubWInt, + PPC::MOF_ZExt | PPC::MOF_RPlusLo | PPC::MOF_WordInt, + PPC::MOF_ZExt | PPC::MOF_RPlusLo | PPC::MOF_SubWInt, + PPC::MOF_SExt | PPC::MOF_RPlusLo | PPC::MOF_SubWInt, + PPC::MOF_ZExt | PPC::MOF_NotAdd | PPC::MOF_WordInt, + PPC::MOF_ZExt | PPC::MOF_NotAdd | PPC::MOF_SubWInt, + PPC::MOF_SExt | PPC::MOF_NotAdd | PPC::MOF_SubWInt, + PPC::MOF_ZExt | PPC::MOF_AddrIsSImm32 | PPC::MOF_WordInt, + PPC::MOF_ZExt | PPC::MOF_AddrIsSImm32 | PPC::MOF_SubWInt, + PPC::MOF_SExt | PPC::MOF_AddrIsSImm32 | PPC::MOF_SubWInt, + PPC::MOF_RPlusSImm16 | PPC::MOF_ScalFlt | PPC::MOF_SubtargetNoP9, + PPC::MOF_RPlusLo | PPC::MOF_ScalFlt | PPC::MOF_SubtargetNoP9, + PPC::MOF_NotAdd | PPC::MOF_ScalFlt | PPC::MOF_SubtargetNoP9, + PPC::MOF_AddrIsSImm32 | PPC::MOF_ScalFlt | PPC::MOF_SubtargetNoP9, + }; + AddrModesMap[PPC::AM_DSForm] = { + PPC::MOF_SExt | PPC::MOF_RPlusSImm16Mult4 | PPC::MOF_WordInt, + PPC::MOF_SExt | PPC::MOF_NotAdd | PPC::MOF_WordInt, + PPC::MOF_SExt | PPC::MOF_AddrIsSImm32 | PPC::MOF_WordInt, + PPC::MOF_RPlusSImm16Mult4 | PPC::MOF_DWInt, + PPC::MOF_NotAdd | PPC::MOF_DWInt, + PPC::MOF_AddrIsSImm32 | PPC::MOF_DWInt, + PPC::MOF_RPlusSImm16Mult4 | PPC::MOF_ScalFlt | PPC::MOF_SubtargetP9, + PPC::MOF_NotAdd | PPC::MOF_ScalFlt | PPC::MOF_SubtargetP9, + PPC::MOF_AddrIsSImm32 | PPC::MOF_ScalFlt | PPC::MOF_SubtargetP9, + }; + AddrModesMap[PPC::AM_DQForm] = { + PPC::MOF_RPlusSImm16Mult16 | PPC::MOF_Vec | PPC::MOF_SubtargetP9, + PPC::MOF_RPlusSImm16Mult16 | PPC::MOF_Vec256 | PPC::MOF_SubtargetP10, + PPC::MOF_NotAdd | PPC::MOF_Vec | PPC::MOF_SubtargetP9, + PPC::MOF_NotAdd | PPC::MOF_Vec256 | PPC::MOF_SubtargetP10, + PPC::MOF_AddrIsSImm32 | PPC::MOF_Vec | PPC::MOF_SubtargetP9, + PPC::MOF_AddrIsSImm32 | PPC::MOF_Vec256 | PPC::MOF_SubtargetP10, + }; +} + /// getMaxByValAlign - Helper for getByValTypeAlignment to determine /// the desired ByVal argument alignment. static void getMaxByValAlign(Type *Ty, Align &MaxAlign, Align MaxMaxAlign) { @@ -2451,6 +2499,19 @@ return isIntS16Immediate(Op.getNode(), Imm); } +/// provablyDisjointOr - used when computing address flags for selecting +/// loads and stores. If we have an OR, check if the LHS and RHS are provably +/// disjoint. This is for when we have an OR of disjoint bitfields, we can +/// codegen it as an add (for better address arithmetic). +static bool provablyDisjointOr(SelectionDAG &DAG, const SDValue &N) { + if (N.getOpcode() != ISD::OR) + return false; + KnownBits LHSKnown = DAG.computeKnownBits(N.getOperand(0)); + if (!LHSKnown.Zero.getBoolValue()) + return false; + KnownBits RHSKnown = DAG.computeKnownBits(N.getOperand(1)); + return (~(LHSKnown.Zero | RHSKnown.Zero) == 0); +} /// SelectAddressEVXRegReg - Given the specified address, check to see if it can /// be represented as an indexed [r+r] operation. @@ -17104,3 +17165,275 @@ return SDValue(); } + +/// getAddrModeForFlags - Based on the set of address flags, select the most +/// optimal instruction format to match by. +PPC::AddrMode PPCTargetLowering::getAddrModeForFlags(unsigned Flags) const { + // This is not a node we should be handling here. + if (Flags == PPC::MOF_None) + return PPC::AM_None; + // Unaligned D-Forms are tried first, followed by the aligned D-Forms. + for (auto FlagSet : AddrModesMap.at(PPC::AM_DForm)) + if ((Flags & FlagSet) == FlagSet) + return PPC::AM_DForm; + for (auto FlagSet : AddrModesMap.at(PPC::AM_DSForm)) + if ((Flags & FlagSet) == FlagSet) + return PPC::AM_DSForm; + for (auto FlagSet : AddrModesMap.at(PPC::AM_DQForm)) + if ((Flags & FlagSet) == FlagSet) + return PPC::AM_DQForm; + // If no other forms are selected, return an X-Form instructions can + // always be matched. + return PPC::AM_XForm; +} + +/// computeMOFlags - Given a node N and it's Parent (a MemSDNode), compute +/// the address flags of the load/store instruction that is to be matched. +/// The address flags are are stored in a map, which is then searched through +/// to determine the optimal load/store instruction format to match by. +unsigned PPCTargetLowering::computeMOFlags(const SDNode *Parent, SDValue N, + SelectionDAG &DAG) const { + unsigned FlagSet = PPC::MOF_None; + + // Compute subtarget flags. + const PPCSubtarget &Subtarget = + static_cast(DAG.getSubtarget()); + if (!Subtarget.hasP9Vector()) + FlagSet |= PPC::MOF_SubtargetNoP9; + else { + FlagSet |= PPC::MOF_SubtargetP9; + if (Subtarget.isISA3_1()) + FlagSet |= PPC::MOF_SubtargetP10; + } + if (Subtarget.hasSPE()) + FlagSet |= PPC::MOF_SubtargetSPE; + + // Mark this as something we don't want to handle here if it is atomic + // or pre-increment instruction. + const MemSDNode *MN = dyn_cast(Parent); + if (const LSBaseSDNode *LSB = dyn_cast(Parent)) + if (LSB->isIndexed()) + return PPC::MOF_None; + if (isa(Parent)) + return PPC::MOF_None; + + // Compute in-memory type flags. This is based on if there are scalars, + // floats or vectors. + assert(MN && "Parent should be a MemSDNode!"); + EVT MemVT = MN->getMemoryVT(); + unsigned Size = MemVT.getSizeInBits(); + if (MemVT.isScalarInteger()) { + assert(Size <= 64 && "Not expecting scalar integers larger than 8 bytes!"); + if (Size < 32) + FlagSet |= PPC::MOF_SubWInt; + else if (Size == 32) + FlagSet |= PPC::MOF_WordInt; + else + FlagSet |= PPC::MOF_DWInt; + } else if (MemVT.isVector() && !MemVT.isFloatingPoint()) { // Vectors only. + if (Size == 128) + FlagSet |= PPC::MOF_Vec; + else if (Size == 256) + FlagSet |= PPC::MOF_Vec256; + else + llvm_unreachable("Not expecting illegal vectors!"); + } else { // Floating point type: can be scalar, f128 or vector types. + if (Size == 32 || Size == 64) + FlagSet |= PPC::MOF_ScalFlt; + else if (MemVT == MVT::f128 || MemVT.isVector()) + FlagSet |= PPC::MOF_Vec; + else + llvm_unreachable("Not expecting illegal scalar floats!"); + } + + auto SetAlignFlagsForImm = [&](uint64_t Imm) { + if ((Imm & 0x3) == 0) + FlagSet |= PPC::MOF_RPlusSImm16Mult4; + if ((Imm & 0xf) == 0) + FlagSet |= PPC::MOF_RPlusSImm16Mult16; + }; + + // Compute flags for address computation. + if (ConstantSDNode *CN = dyn_cast(N)) { + // All 32-bit constants can be computed as LIS + Disp. + const APInt &ConstImm = CN->getAPIntValue(); + if (ConstImm.isSignedIntN(32)) { // Flag to handle 32-bit consstants. + FlagSet |= PPC::MOF_AddrIsSImm32; + SetAlignFlagsForImm(ConstImm.getZExtValue()); + } else if (ConstImm.isSignedIntN(34)) // Flag to handle 34-bit constants. + FlagSet |= PPC::MOF_RPlusSImm34; + else // Let constant materialization handle large constants. + FlagSet |= PPC::MOF_NotAdd; + } else if (N.getOpcode() == ISD::ADD || provablyDisjointOr(DAG, N)) { + // This address can be represented as an addition of: + // - Register + Imm16 (possibly a multiple of 4/16) + // - Register + Imm34 + // - Register + PPCISD::Lo + // - Register + Register + // In any case, we won't have to match this as Base + Zero. + SDValue RHS = N.getOperand(1); + if (ConstantSDNode *CN = dyn_cast(RHS)) { + const APInt &ConstImm = CN->getAPIntValue(); + if (ConstImm.isSignedIntN(16)) { + FlagSet |= PPC::MOF_RPlusSImm16; // Signed 16-bit immediates. + SetAlignFlagsForImm(ConstImm.getZExtValue()); + } else if (ConstImm.isSignedIntN(34)) + FlagSet |= PPC::MOF_RPlusSImm34; // Signed 34-bit immediates. + else + FlagSet |= PPC::MOF_RPlusR; // Register. + } else if (RHS.getOpcode() == PPCISD::Lo && + !cast(RHS.getOperand(1))->getZExtValue()) + FlagSet |= PPC::MOF_RPlusLo; // PPCISD::Lo. + else + FlagSet |= PPC::MOF_RPlusR; + } else // The address computation is not a constant or an addition. + FlagSet |= PPC::MOF_NotAdd; + + // Compute type extension flags. + if (const LoadSDNode *LN = dyn_cast(Parent)) { + switch (LN->getExtensionType()) { + case ISD::SEXTLOAD: + FlagSet |= PPC::MOF_SExt; + break; + case ISD::EXTLOAD: + case ISD::ZEXTLOAD: + FlagSet |= PPC::MOF_ZExt; + break; + case ISD::NON_EXTLOAD: + FlagSet |= PPC::MOF_NoExt; + break; + } + } else + FlagSet |= PPC::MOF_NoExt; + + // For integers, no extension is the same as zero extension. + if (MemVT.isScalarInteger() && (FlagSet & PPC::MOF_NoExt)) { + FlagSet |= PPC::MOF_ZExt; + FlagSet &= ~PPC::MOF_NoExt; + } + + // Prior to P10, constants that fit in 34-bits on should be marked with + // `PPC::MOF_NotAdd` to match by D-Form. + if (N.getOpcode() != ISD::ADD && N.getOpcode() != ISD::OR && + (FlagSet & PPC::MOF_RPlusSImm34) && !(FlagSet & PPC::MOF_AddrIsSImm32) && + !(FlagSet & PPC::MOF_SubtargetP10)) + FlagSet |= PPC::MOF_NotAdd; + + return FlagSet; +} + +/// SelectForceXFormMode - Given the specified address, force it to be +/// represented as an indexed [r+r] operation (an XForm instruction). +PPC::AddrMode PPCTargetLowering::SelectForceXFormMode(SDValue N, SDValue &Disp, + SDValue &Base, + SelectionDAG &DAG) const { + + PPC::AddrMode Mode = PPC::AM_XForm; + // If the address is the result of an add, we will utilize the fact that the + // address calculation includes an implicit add. Register pressure if we do + // not materialize a constant just for use as the index register. + // The add is only removed if it is not an add of a value and a 16-bit signed + // constant and both have a single use. + int16_t ForceXFormImm = 0; + if (N.getOpcode() == ISD::ADD && + (!isIntS16Immediate(N.getOperand(1), ForceXFormImm) || + !N.getOperand(1).hasOneUse() || !N.getOperand(0).hasOneUse())) { + Disp = N.getOperand(0); + Base = N.getOperand(1); + return Mode; + } + + // Otherwise, use R0 as the base register. + Disp = DAG.getRegister(Subtarget.isPPC64() ? PPC::ZERO8 : PPC::ZERO, + N.getValueType()); + Base = N; + + return Mode; +} + +/// SelectOptimalAddrMode - Based on a node N and it's Parent (a MemSDNode), +/// compute the address flags of the node, get the optimal address mode based +/// on the flags, and set the Base and Disp based on the address mode. +PPC::AddrMode PPCTargetLowering::SelectOptimalAddrMode(const SDNode *Parent, + SDValue N, SDValue &Disp, + SDValue &Base, + SelectionDAG &DAG, + MaybeAlign Align) const { + SDLoc DL(Parent); + + // Compute the address flags. + unsigned Flags = computeMOFlags(Parent, N, DAG); + + // Get the optimal address mode based on the Flags. + PPC::AddrMode Mode = getAddrModeForFlags(Flags); + + // Set Base and Disp accordingly depending on the address mode. + switch (Mode) { + case PPC::AM_DForm: + case PPC::AM_DSForm: + case PPC::AM_DQForm: { + // Can represent as an ADD. + if (Flags & PPC::MOF_RPlusSImm16) { + int16_t Imm = 0; + SDValue Op0 = N.getOperand(0); + SDValue Op1 = N.getOperand(1); + if (isIntS16Immediate(Op1, Imm) && (!Align || isAligned(*Align, Imm))) { + Disp = DAG.getTargetConstant(Imm, DL, N.getValueType()); + if (FrameIndexSDNode *FI = dyn_cast(Op0)) { + Base = DAG.getTargetFrameIndex(FI->getIndex(), N.getValueType()); + fixupFuncForFI(DAG, FI->getIndex(), N.getValueType()); + } else + Base = Op0; + break; + } + } + // Match LOAD (ADD (X, Lo(G))). + else if (Flags & PPC::MOF_RPlusLo) { + Disp = N.getOperand(1).getOperand(0); // The global address. + assert(Disp.getOpcode() == ISD::TargetGlobalAddress || + Disp.getOpcode() == ISD::TargetGlobalTLSAddress || + Disp.getOpcode() == ISD::TargetConstantPool || + Disp.getOpcode() == ISD::TargetJumpTable); + Base = N.getOperand(0); + break; + } + // Match 16-bit and 32-bit constant addresses. + else if (Flags & PPC::MOF_AddrIsSImm32) { + ConstantSDNode *CN = dyn_cast(N); + EVT CNType = CN->getValueType(0); + const APInt &ConstImm = CN->getAPIntValue(); + uint64_t Imm = ConstImm.getZExtValue(); + if (ConstImm.isSignedIntN(16) && (!Align || isAligned(*Align, Imm))) { + Disp = DAG.getTargetConstant(Imm, DL, CNType); + Base = DAG.getRegister(Subtarget.isPPC64() ? PPC::ZERO8 : PPC::ZERO, + CNType); + break; + } else if (ConstImm.isSignedIntN(32) && + (!Align || isAligned(*Align, Imm))) { + Disp = DAG.getTargetConstant((short)Imm, DL, MVT::i32); + Base = DAG.getTargetConstant((Imm - (signed short)Imm) >> 16, DL, + MVT::i32); + unsigned LIS = CNType == MVT::i32 ? PPC::LIS : PPC::LIS8; + Base = SDValue(DAG.getMachineNode(LIS, DL, CNType, Base), 0); + break; + } + } + // Otherwise, the PPC:MOF_NotAdd flag is set. Load/Store is Non-foldable. + Disp = DAG.getTargetConstant(0, DL, getPointerTy(DAG.getDataLayout())); + if (FrameIndexSDNode *FI = dyn_cast(N)) { + Base = DAG.getTargetFrameIndex(FI->getIndex(), N.getValueType()); + fixupFuncForFI(DAG, FI->getIndex(), N.getValueType()); + } else + Base = N; + break; + } + case PPC::AM_None: + break; + default: { // By default, X-Form is always available to be selected. + Base = N.getOperand(1); + Disp = N.getOperand(0); + break; + } + } + return Mode; +} diff --git a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td --- a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td @@ -1057,21 +1057,21 @@ let Interpretation64Bit = 1, isCodeGenOnly = 1 in def LHA8: DForm_1<42, (outs g8rc:$rD), (ins memri:$src), "lha $rD, $src", IIC_LdStLHA, - [(set i64:$rD, (sextloadi16 iaddr:$src))]>, + [(set i64:$rD, (sextloadi16 DForm:$src))]>, PPC970_DGroup_Cracked; def LWA : DSForm_1<58, 2, (outs g8rc:$rD), (ins memrix:$src), "lwa $rD, $src", IIC_LdStLWA, [(set i64:$rD, - (DSFormSextLoadi32 iaddrX4:$src))]>, isPPC64, + (sextloadi32 DSForm:$src))]>, isPPC64, PPC970_DGroup_Cracked; let Interpretation64Bit = 1, isCodeGenOnly = 1 in def LHAX8: XForm_1_memOp<31, 343, (outs g8rc:$rD), (ins memrr:$src), "lhax $rD, $src", IIC_LdStLHA, - [(set i64:$rD, (sextloadi16 xaddr:$src))]>, + [(set i64:$rD, (sextloadi16 XForm:$src))]>, PPC970_DGroup_Cracked; def LWAX : XForm_1_memOp<31, 341, (outs g8rc:$rD), (ins memrr:$src), "lwax $rD, $src", IIC_LdStLHA, - [(set i64:$rD, (sextloadi32 xaddrX4:$src))]>, isPPC64, + [(set i64:$rD, (sextloadi32 XForm:$src))]>, isPPC64, PPC970_DGroup_Cracked; // For fast-isel: let isCodeGenOnly = 1, mayLoad = 1, hasSideEffects = 0 in { @@ -1112,23 +1112,23 @@ let PPC970_Unit = 2 in { def LBZ8 : DForm_1<34, (outs g8rc:$rD), (ins memri:$src), "lbz $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (zextloadi8 iaddr:$src))]>; + [(set i64:$rD, (zextloadi8 DForm:$src))]>; def LHZ8 : DForm_1<40, (outs g8rc:$rD), (ins memri:$src), "lhz $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (zextloadi16 iaddr:$src))]>; + [(set i64:$rD, (zextloadi16 DForm:$src))]>; def LWZ8 : DForm_1<32, (outs g8rc:$rD), (ins memri:$src), "lwz $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (zextloadi32 iaddr:$src))]>, isPPC64; + [(set i64:$rD, (zextloadi32 DForm:$src))]>, isPPC64; def LBZX8 : XForm_1_memOp<31, 87, (outs g8rc:$rD), (ins memrr:$src), "lbzx $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (zextloadi8 xaddr:$src))]>; + [(set i64:$rD, (zextloadi8 XForm:$src))]>; def LHZX8 : XForm_1_memOp<31, 279, (outs g8rc:$rD), (ins memrr:$src), "lhzx $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (zextloadi16 xaddr:$src))]>; + [(set i64:$rD, (zextloadi16 XForm:$src))]>; def LWZX8 : XForm_1_memOp<31, 23, (outs g8rc:$rD), (ins memrr:$src), "lwzx $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (zextloadi32 xaddr:$src))]>; + [(set i64:$rD, (zextloadi32 XForm:$src))]>; // Update forms. @@ -1173,7 +1173,7 @@ let PPC970_Unit = 2 in { def LD : DSForm_1<58, 0, (outs g8rc:$rD), (ins memrix:$src), "ld $rD, $src", IIC_LdStLD, - [(set i64:$rD, (DSFormLoad iaddrX4:$src))]>, isPPC64; + [(set i64:$rD, (load DSForm:$src))]>, isPPC64; // The following four definitions are selected for small code model only. // Otherwise, we need to create two instructions to form a 32-bit offset, // so we have a custom matcher for TOC_ENTRY in PPCDAGToDAGIsel::Select(). @@ -1196,10 +1196,10 @@ def LDX : XForm_1_memOp<31, 21, (outs g8rc:$rD), (ins memrr:$src), "ldx $rD, $src", IIC_LdStLD, - [(set i64:$rD, (load xaddrX4:$src))]>, isPPC64; + [(set i64:$rD, (load XForm:$src))]>, isPPC64; def LDBRX : XForm_1_memOp<31, 532, (outs g8rc:$rD), (ins memrr:$src), "ldbrx $rD, $src", IIC_LdStLoad, - [(set i64:$rD, (PPClbrx xoaddr:$src, i64))]>, isPPC64; + [(set i64:$rD, (PPClbrx ForceXForm:$src, i64))]>, isPPC64; let mayLoad = 1, hasSideEffects = 0, isCodeGenOnly = 1 in { def LHBRX8 : XForm_1_memOp<31, 790, (outs g8rc:$rD), (ins memrr:$src), @@ -1356,38 +1356,38 @@ // Truncating stores. def STB8 : DForm_1<38, (outs), (ins g8rc:$rS, memri:$src), "stb $rS, $src", IIC_LdStStore, - [(truncstorei8 i64:$rS, iaddr:$src)]>; + [(truncstorei8 i64:$rS, DForm:$src)]>; def STH8 : DForm_1<44, (outs), (ins g8rc:$rS, memri:$src), "sth $rS, $src", IIC_LdStStore, - [(truncstorei16 i64:$rS, iaddr:$src)]>; + [(truncstorei16 i64:$rS, DForm:$src)]>; def STW8 : DForm_1<36, (outs), (ins g8rc:$rS, memri:$src), "stw $rS, $src", IIC_LdStStore, - [(truncstorei32 i64:$rS, iaddr:$src)]>; + [(truncstorei32 i64:$rS, DForm:$src)]>; def STBX8 : XForm_8_memOp<31, 215, (outs), (ins g8rc:$rS, memrr:$dst), "stbx $rS, $dst", IIC_LdStStore, - [(truncstorei8 i64:$rS, xaddr:$dst)]>, + [(truncstorei8 i64:$rS, XForm:$dst)]>, PPC970_DGroup_Cracked; def STHX8 : XForm_8_memOp<31, 407, (outs), (ins g8rc:$rS, memrr:$dst), "sthx $rS, $dst", IIC_LdStStore, - [(truncstorei16 i64:$rS, xaddr:$dst)]>, + [(truncstorei16 i64:$rS, XForm:$dst)]>, PPC970_DGroup_Cracked; def STWX8 : XForm_8_memOp<31, 151, (outs), (ins g8rc:$rS, memrr:$dst), "stwx $rS, $dst", IIC_LdStStore, - [(truncstorei32 i64:$rS, xaddr:$dst)]>, + [(truncstorei32 i64:$rS, XForm:$dst)]>, PPC970_DGroup_Cracked; } // Interpretation64Bit // Normal 8-byte stores. def STD : DSForm_1<62, 0, (outs), (ins g8rc:$rS, memrix:$dst), "std $rS, $dst", IIC_LdStSTD, - [(DSFormStore i64:$rS, iaddrX4:$dst)]>, isPPC64; + [(store i64:$rS, DSForm:$dst)]>, isPPC64; def STDX : XForm_8_memOp<31, 149, (outs), (ins g8rc:$rS, memrr:$dst), "stdx $rS, $dst", IIC_LdStSTD, - [(store i64:$rS, xaddrX4:$dst)]>, isPPC64, + [(store i64:$rS, XForm:$dst)]>, isPPC64, PPC970_DGroup_Cracked; def STDBRX: XForm_8_memOp<31, 660, (outs), (ins g8rc:$rS, memrr:$dst), "stdbrx $rS, $dst", IIC_LdStStore, - [(PPCstbrx i64:$rS, xoaddr:$dst, i64)]>, isPPC64, + [(PPCstbrx i64:$rS, ForceXForm:$dst, i64)]>, isPPC64, PPC970_DGroup_Cracked; } @@ -1520,26 +1520,26 @@ (i64not $in)>; // Extending loads with i64 targets. -def : Pat<(zextloadi1 iaddr:$src), - (LBZ8 iaddr:$src)>; -def : Pat<(zextloadi1 xaddr:$src), - (LBZX8 xaddr:$src)>; -def : Pat<(extloadi1 iaddr:$src), - (LBZ8 iaddr:$src)>; -def : Pat<(extloadi1 xaddr:$src), - (LBZX8 xaddr:$src)>; -def : Pat<(extloadi8 iaddr:$src), - (LBZ8 iaddr:$src)>; -def : Pat<(extloadi8 xaddr:$src), - (LBZX8 xaddr:$src)>; -def : Pat<(extloadi16 iaddr:$src), - (LHZ8 iaddr:$src)>; -def : Pat<(extloadi16 xaddr:$src), - (LHZX8 xaddr:$src)>; -def : Pat<(extloadi32 iaddr:$src), - (LWZ8 iaddr:$src)>; -def : Pat<(extloadi32 xaddr:$src), - (LWZX8 xaddr:$src)>; +def : Pat<(zextloadi1 DForm:$src), + (LBZ8 DForm:$src)>; +def : Pat<(zextloadi1 XForm:$src), + (LBZX8 XForm:$src)>; +def : Pat<(extloadi1 DForm:$src), + (LBZ8 DForm:$src)>; +def : Pat<(extloadi1 XForm:$src), + (LBZX8 XForm:$src)>; +def : Pat<(extloadi8 DForm:$src), + (LBZ8 DForm:$src)>; +def : Pat<(extloadi8 XForm:$src), + (LBZX8 XForm:$src)>; +def : Pat<(extloadi16 DForm:$src), + (LHZ8 DForm:$src)>; +def : Pat<(extloadi16 XForm:$src), + (LHZX8 XForm:$src)>; +def : Pat<(extloadi32 DForm:$src), + (LWZ8 DForm:$src)>; +def : Pat<(extloadi32 XForm:$src), + (LWZX8 XForm:$src)>; // Standard shifts. These are represented separately from the real shifts above // so that we can distinguish between shifts that allow 6-bit and 7-bit shift @@ -1591,12 +1591,12 @@ // Patterns to match r+r indexed loads and stores for // addresses without at least 4-byte alignment. -def : Pat<(i64 (NonDSFormSextLoadi32 xoaddr:$src)), - (LWAX xoaddr:$src)>; -def : Pat<(i64 (NonDSFormLoad xoaddr:$src)), - (LDX xoaddr:$src)>; -def : Pat<(NonDSFormStore i64:$rS, xoaddr:$dst), - (STDX $rS, xoaddr:$dst)>; +def : Pat<(i64 (sextloadi32 ForceXForm:$src)), + (LWAX ForceXForm:$src)>; +def : Pat<(i64 (load ForceXForm:$src)), + (LDX ForceXForm:$src)>; +def : Pat<(store i64:$rS, ForceXForm:$dst), + (STDX $rS, ForceXForm:$dst)>; // 64-bits atomic loads and stores def : Pat<(atomic_load_64 iaddrX4:$src), (LD memrix:$src)>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td --- a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td +++ b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td @@ -416,46 +416,46 @@ let PPC970_Unit = 2, mayLoad = 1, mayStore = 0 in { // Loads. def LVEBX: XForm_1_memOp<31, 7, (outs vrrc:$vD), (ins memrr:$src), "lvebx $vD, $src", IIC_LdStLoad, - [(set v16i8:$vD, (int_ppc_altivec_lvebx xoaddr:$src))]>; + [(set v16i8:$vD, (int_ppc_altivec_lvebx ForceXForm:$src))]>; def LVEHX: XForm_1_memOp<31, 39, (outs vrrc:$vD), (ins memrr:$src), "lvehx $vD, $src", IIC_LdStLoad, - [(set v8i16:$vD, (int_ppc_altivec_lvehx xoaddr:$src))]>; + [(set v8i16:$vD, (int_ppc_altivec_lvehx ForceXForm:$src))]>; def LVEWX: XForm_1_memOp<31, 71, (outs vrrc:$vD), (ins memrr:$src), "lvewx $vD, $src", IIC_LdStLoad, - [(set v4i32:$vD, (int_ppc_altivec_lvewx xoaddr:$src))]>; + [(set v4i32:$vD, (int_ppc_altivec_lvewx ForceXForm:$src))]>; def LVX : XForm_1_memOp<31, 103, (outs vrrc:$vD), (ins memrr:$src), "lvx $vD, $src", IIC_LdStLoad, - [(set v4i32:$vD, (int_ppc_altivec_lvx xoaddr:$src))]>; + [(set v4i32:$vD, (int_ppc_altivec_lvx ForceXForm:$src))]>; def LVXL : XForm_1_memOp<31, 359, (outs vrrc:$vD), (ins memrr:$src), "lvxl $vD, $src", IIC_LdStLoad, - [(set v4i32:$vD, (int_ppc_altivec_lvxl xoaddr:$src))]>; + [(set v4i32:$vD, (int_ppc_altivec_lvxl ForceXForm:$src))]>; } def LVSL : XForm_1_memOp<31, 6, (outs vrrc:$vD), (ins memrr:$src), "lvsl $vD, $src", IIC_LdStLoad, - [(set v16i8:$vD, (int_ppc_altivec_lvsl xoaddr:$src))]>, + [(set v16i8:$vD, (int_ppc_altivec_lvsl ForceXForm:$src))]>, PPC970_Unit_LSU; def LVSR : XForm_1_memOp<31, 38, (outs vrrc:$vD), (ins memrr:$src), "lvsr $vD, $src", IIC_LdStLoad, - [(set v16i8:$vD, (int_ppc_altivec_lvsr xoaddr:$src))]>, + [(set v16i8:$vD, (int_ppc_altivec_lvsr ForceXForm:$src))]>, PPC970_Unit_LSU; let PPC970_Unit = 2, mayStore = 1, mayLoad = 0 in { // Stores. def STVEBX: XForm_8_memOp<31, 135, (outs), (ins vrrc:$rS, memrr:$dst), "stvebx $rS, $dst", IIC_LdStStore, - [(int_ppc_altivec_stvebx v16i8:$rS, xoaddr:$dst)]>; + [(int_ppc_altivec_stvebx v16i8:$rS, ForceXForm:$dst)]>; def STVEHX: XForm_8_memOp<31, 167, (outs), (ins vrrc:$rS, memrr:$dst), "stvehx $rS, $dst", IIC_LdStStore, - [(int_ppc_altivec_stvehx v8i16:$rS, xoaddr:$dst)]>; + [(int_ppc_altivec_stvehx v8i16:$rS, ForceXForm:$dst)]>; def STVEWX: XForm_8_memOp<31, 199, (outs), (ins vrrc:$rS, memrr:$dst), "stvewx $rS, $dst", IIC_LdStStore, - [(int_ppc_altivec_stvewx v4i32:$rS, xoaddr:$dst)]>; + [(int_ppc_altivec_stvewx v4i32:$rS, ForceXForm:$dst)]>; def STVX : XForm_8_memOp<31, 231, (outs), (ins vrrc:$rS, memrr:$dst), "stvx $rS, $dst", IIC_LdStStore, - [(int_ppc_altivec_stvx v4i32:$rS, xoaddr:$dst)]>; + [(int_ppc_altivec_stvx v4i32:$rS, ForceXForm:$dst)]>; def STVXL : XForm_8_memOp<31, 487, (outs), (ins vrrc:$rS, memrr:$dst), "stvxl $rS, $dst", IIC_LdStStore, - [(int_ppc_altivec_stvxl v4i32:$rS, xoaddr:$dst)]>; + [(int_ppc_altivec_stvxl v4i32:$rS, ForceXForm:$dst)]>; } let PPC970_Unit = 5 in { // VALU Operations. @@ -899,11 +899,11 @@ def : Pat<(v4i32 (usubsat v4i32:$vA, v4i32:$vB)), (v4i32 (VSUBUWS $vA, $vB))>; // Loads. -def : Pat<(v4i32 (load xoaddr:$src)), (LVX xoaddr:$src)>; +def : Pat<(v4i32 (load ForceXForm:$src)), (LVX ForceXForm:$src)>; // Stores. -def : Pat<(store v4i32:$rS, xoaddr:$dst), - (STVX $rS, xoaddr:$dst)>; +def : Pat<(store v4i32:$rS, ForceXForm:$dst), + (STVX $rS, ForceXForm:$dst)>; // Bit conversions. def : Pat<(v16i8 (bitconvert (v8i16 VRRC:$src))), (v16i8 VRRC:$src)>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -1095,6 +1095,13 @@ // PC Relative Address def pcreladdr : ComplexPattern; +// Load and Store Instruction Selection addressing modes. +def DForm : ComplexPattern; +def DSForm : ComplexPattern; +def DQForm : ComplexPattern; +def XForm : ComplexPattern; +def ForceXForm : ComplexPattern; + //===----------------------------------------------------------------------===// // PowerPC Instruction Predicate Definitions. def In32BitMode : Predicate<"!Subtarget->isPPC64()">; @@ -2169,25 +2176,25 @@ let PPC970_Unit = 2 in { def LBZ : DForm_1<34, (outs gprc:$rD), (ins memri:$src), "lbz $rD, $src", IIC_LdStLoad, - [(set i32:$rD, (zextloadi8 iaddr:$src))]>; + [(set i32:$rD, (zextloadi8 DForm:$src))]>; def LHA : DForm_1<42, (outs gprc:$rD), (ins memri:$src), "lha $rD, $src", IIC_LdStLHA, - [(set i32:$rD, (sextloadi16 iaddr:$src))]>, + [(set i32:$rD, (sextloadi16 DForm:$src))]>, PPC970_DGroup_Cracked; def LHZ : DForm_1<40, (outs gprc:$rD), (ins memri:$src), "lhz $rD, $src", IIC_LdStLoad, - [(set i32:$rD, (zextloadi16 iaddr:$src))]>; + [(set i32:$rD, (zextloadi16 DForm:$src))]>; def LWZ : DForm_1<32, (outs gprc:$rD), (ins memri:$src), "lwz $rD, $src", IIC_LdStLoad, - [(set i32:$rD, (load iaddr:$src))]>; + [(set i32:$rD, (load DForm:$src))]>; let Predicates = [HasFPU] in { def LFS : DForm_1<48, (outs f4rc:$rD), (ins memri:$src), "lfs $rD, $src", IIC_LdStLFD, - [(set f32:$rD, (load iaddr:$src))]>; + [(set f32:$rD, (load DForm:$src))]>; def LFD : DForm_1<50, (outs f8rc:$rD), (ins memri:$src), "lfd $rD, $src", IIC_LdStLFD, - [(set f64:$rD, (load iaddr:$src))]>; + [(set f64:$rD, (load DForm:$src))]>; } @@ -2272,17 +2279,17 @@ let PPC970_Unit = 2, mayLoad = 1, mayStore = 0 in { def LBZX : XForm_1_memOp<31, 87, (outs gprc:$rD), (ins memrr:$src), "lbzx $rD, $src", IIC_LdStLoad, - [(set i32:$rD, (zextloadi8 xaddr:$src))]>; + [(set i32:$rD, (zextloadi8 XForm:$src))]>; def LHAX : XForm_1_memOp<31, 343, (outs gprc:$rD), (ins memrr:$src), "lhax $rD, $src", IIC_LdStLHA, - [(set i32:$rD, (sextloadi16 xaddr:$src))]>, + [(set i32:$rD, (sextloadi16 XForm:$src))]>, PPC970_DGroup_Cracked; def LHZX : XForm_1_memOp<31, 279, (outs gprc:$rD), (ins memrr:$src), "lhzx $rD, $src", IIC_LdStLoad, - [(set i32:$rD, (zextloadi16 xaddr:$src))]>; + [(set i32:$rD, (zextloadi16 XForm:$src))]>; def LWZX : XForm_1_memOp<31, 23, (outs gprc:$rD), (ins memrr:$src), "lwzx $rD, $src", IIC_LdStLoad, - [(set i32:$rD, (load xaddr:$src))]>; + [(set i32:$rD, (load XForm:$src))]>; def LHBRX : XForm_1_memOp<31, 790, (outs gprc:$rD), (ins memrr:$src), "lhbrx $rD, $src", IIC_LdStLoad, [(set i32:$rD, (PPClbrx xoaddr:$src, i16))]>; @@ -2293,10 +2300,10 @@ let Predicates = [HasFPU] in { def LFSX : XForm_25_memOp<31, 535, (outs f4rc:$frD), (ins memrr:$src), "lfsx $frD, $src", IIC_LdStLFD, - [(set f32:$frD, (load xaddr:$src))]>; + [(set f32:$frD, (load XForm:$src))]>; def LFDX : XForm_25_memOp<31, 599, (outs f8rc:$frD), (ins memrr:$src), "lfdx $frD, $src", IIC_LdStLFD, - [(set f64:$frD, (load xaddr:$src))]>; + [(set f64:$frD, (load XForm:$src))]>; def LFIWAX : XForm_25_memOp<31, 855, (outs f8rc:$frD), (ins memrr:$src), "lfiwax $frD, $src", IIC_LdStLFD, @@ -2320,20 +2327,20 @@ let PPC970_Unit = 2, mayStore = 1, mayLoad = 0 in { def STB : DForm_1<38, (outs), (ins gprc:$rS, memri:$dst), "stb $rS, $dst", IIC_LdStStore, - [(truncstorei8 i32:$rS, iaddr:$dst)]>; + [(truncstorei8 i32:$rS, DForm:$dst)]>; def STH : DForm_1<44, (outs), (ins gprc:$rS, memri:$dst), "sth $rS, $dst", IIC_LdStStore, - [(truncstorei16 i32:$rS, iaddr:$dst)]>; + [(truncstorei16 i32:$rS, DForm:$dst)]>; def STW : DForm_1<36, (outs), (ins gprc:$rS, memri:$dst), "stw $rS, $dst", IIC_LdStStore, - [(store i32:$rS, iaddr:$dst)]>; + [(store i32:$rS, DForm:$dst)]>; let Predicates = [HasFPU] in { def STFS : DForm_1<52, (outs), (ins f4rc:$rS, memri:$dst), "stfs $rS, $dst", IIC_LdStSTFD, - [(store f32:$rS, iaddr:$dst)]>; + [(store f32:$rS, DForm:$dst)]>; def STFD : DForm_1<54, (outs), (ins f8rc:$rS, memri:$dst), "stfd $rS, $dst", IIC_LdStSTFD, - [(store f64:$rS, iaddr:$dst)]>; + [(store f64:$rS, DForm:$dst)]>; } } @@ -2376,15 +2383,15 @@ let PPC970_Unit = 2 in { def STBX : XForm_8_memOp<31, 215, (outs), (ins gprc:$rS, memrr:$dst), "stbx $rS, $dst", IIC_LdStStore, - [(truncstorei8 i32:$rS, xaddr:$dst)]>, + [(truncstorei8 i32:$rS, XForm:$dst)]>, PPC970_DGroup_Cracked; def STHX : XForm_8_memOp<31, 407, (outs), (ins gprc:$rS, memrr:$dst), "sthx $rS, $dst", IIC_LdStStore, - [(truncstorei16 i32:$rS, xaddr:$dst)]>, + [(truncstorei16 i32:$rS, XForm:$dst)]>, PPC970_DGroup_Cracked; def STWX : XForm_8_memOp<31, 151, (outs), (ins gprc:$rS, memrr:$dst), "stwx $rS, $dst", IIC_LdStStore, - [(store i32:$rS, xaddr:$dst)]>, + [(store i32:$rS, XForm:$dst)]>, PPC970_DGroup_Cracked; def STHBRX: XForm_8_memOp<31, 918, (outs), (ins gprc:$rS, memrr:$dst), @@ -2403,10 +2410,10 @@ def STFSX : XForm_28_memOp<31, 663, (outs), (ins f4rc:$frS, memrr:$dst), "stfsx $frS, $dst", IIC_LdStSTFD, - [(store f32:$frS, xaddr:$dst)]>; + [(store f32:$frS, XForm:$dst)]>; def STFDX : XForm_28_memOp<31, 727, (outs), (ins f8rc:$frS, memrr:$dst), "stfdx $frS, $dst", IIC_LdStSTFD, - [(store f64:$frS, xaddr:$dst)]>; + [(store f64:$frS, XForm:$dst)]>; } } @@ -3486,27 +3493,27 @@ def : Pat<(shl i32:$rS, i32:$rB), (SLW $rS, $rB)>; -def : Pat<(i32 (zextloadi1 iaddr:$src)), - (LBZ iaddr:$src)>; -def : Pat<(i32 (zextloadi1 xaddr:$src)), - (LBZX xaddr:$src)>; -def : Pat<(i32 (extloadi1 iaddr:$src)), - (LBZ iaddr:$src)>; -def : Pat<(i32 (extloadi1 xaddr:$src)), - (LBZX xaddr:$src)>; -def : Pat<(i32 (extloadi8 iaddr:$src)), - (LBZ iaddr:$src)>; -def : Pat<(i32 (extloadi8 xaddr:$src)), - (LBZX xaddr:$src)>; -def : Pat<(i32 (extloadi16 iaddr:$src)), - (LHZ iaddr:$src)>; -def : Pat<(i32 (extloadi16 xaddr:$src)), - (LHZX xaddr:$src)>; +def : Pat<(i32 (zextloadi1 DForm:$src)), + (LBZ DForm:$src)>; +def : Pat<(i32 (zextloadi1 XForm:$src)), + (LBZX XForm:$src)>; +def : Pat<(i32 (extloadi1 DForm:$src)), + (LBZ DForm:$src)>; +def : Pat<(i32 (extloadi1 XForm:$src)), + (LBZX XForm:$src)>; +def : Pat<(i32 (extloadi8 DForm:$src)), + (LBZ DForm:$src)>; +def : Pat<(i32 (extloadi8 XForm:$src)), + (LBZX XForm:$src)>; +def : Pat<(i32 (extloadi16 DForm:$src)), + (LHZ DForm:$src)>; +def : Pat<(i32 (extloadi16 XForm:$src)), + (LHZX XForm:$src)>; let Predicates = [HasFPU] in { -def : Pat<(f64 (extloadf32 iaddr:$src)), - (COPY_TO_REGCLASS (LFS iaddr:$src), F8RC)>; -def : Pat<(f64 (extloadf32 xaddr:$src)), - (COPY_TO_REGCLASS (LFSX xaddr:$src), F8RC)>; +def : Pat<(f64 (extloadf32 DForm:$src)), + (COPY_TO_REGCLASS (LFS DForm:$src), F8RC)>; +def : Pat<(f64 (extloadf32 XForm:$src)), + (COPY_TO_REGCLASS (LFSX XForm:$src), F8RC)>; def : Pat<(f64 (any_fpextend f32:$src)), (COPY_TO_REGCLASS $src, F8RC)>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrVSX.td b/llvm/lib/Target/PowerPC/PPCInstrVSX.td --- a/llvm/lib/Target/PowerPC/PPCInstrVSX.td +++ b/llvm/lib/Target/PowerPC/PPCInstrVSX.td @@ -315,13 +315,13 @@ let CodeSize = 3 in def XFLOADf64 : PseudoXFormMemOp<(outs vsfrc:$XT), (ins memrr:$src), "#XFLOADf64", - [(set f64:$XT, (load xoaddr:$src))]>; + [(set f64:$XT, (load ForceXForm:$src))]>; let Predicates = [HasVSX, HasOnlySwappingMemOps] in def LXVD2X : XX1Form_memOp<31, 844, (outs vsrc:$XT), (ins memrr:$src), "lxvd2x $XT, $src", IIC_LdStLFD, - [(set v2f64:$XT, (int_ppc_vsx_lxvd2x xoaddr:$src))]>; + [(set v2f64:$XT, (int_ppc_vsx_lxvd2x ForceXForm:$src))]>; def LXVDSX : XX1Form_memOp<31, 332, (outs vsrc:$XT), (ins memrr:$src), @@ -346,7 +346,7 @@ let CodeSize = 3 in def XFSTOREf64 : PseudoXFormMemOp<(outs), (ins vsfrc:$XT, memrr:$dst), "#XFSTOREf64", - [(store f64:$XT, xoaddr:$dst)]>; + [(store f64:$XT, ForceXForm:$dst)]>; let Predicates = [HasVSX, HasOnlySwappingMemOps] in { // The behaviour of this instruction is endianness-specific so we provide no @@ -1126,15 +1126,15 @@ let CodeSize = 3 in def XFLOADf32 : PseudoXFormMemOp<(outs vssrc:$XT), (ins memrr:$src), "#XFLOADf32", - [(set f32:$XT, (load xoaddr:$src))]>; + [(set f32:$XT, (load ForceXForm:$src))]>; // Pseudo instruction LIWAX will be expanded to LXSIWAX or LFIWAX later def LIWAX : PseudoXFormMemOp<(outs vsfrc:$XT), (ins memrr:$src), "#LIWAX", - [(set f64:$XT, (PPClfiwax xoaddr:$src))]>; + [(set f64:$XT, (PPClfiwax ForceXForm:$src))]>; // Pseudo instruction LIWZX will be expanded to LXSIWZX or LFIWZX later def LIWZX : PseudoXFormMemOp<(outs vsfrc:$XT), (ins memrr:$src), "#LIWZX", - [(set f64:$XT, (PPClfiwzx xoaddr:$src))]>; + [(set f64:$XT, (PPClfiwzx ForceXForm:$src))]>; } // mayLoad // VSX scalar stores introduced in ISA 2.07 @@ -1149,11 +1149,11 @@ let CodeSize = 3 in def XFSTOREf32 : PseudoXFormMemOp<(outs), (ins vssrc:$XT, memrr:$dst), "#XFSTOREf32", - [(store f32:$XT, xoaddr:$dst)]>; + [(store f32:$XT, ForceXForm:$dst)]>; // Pseudo instruction STIWX will be expanded to STXSIWX or STFIWX later def STIWX : PseudoXFormMemOp<(outs), (ins vsfrc:$XT, memrr:$dst), "#STIWX", - [(PPCstfiwx f64:$XT, xoaddr:$dst)]>; + [(PPCstfiwx f64:$XT, ForceXForm:$dst)]>; } // mayStore // VSX Elementary Scalar FP arithmetic (SP) @@ -1680,9 +1680,9 @@ // Load as Integer Byte/Halfword & Zero Indexed def LXSIBZX : X_XT6_RA5_RB5<31, 781, "lxsibzx", vsfrc, - [(set f64:$XT, (PPClxsizx xoaddr:$src, 1))]>; + [(set f64:$XT, (PPClxsizx ForceXForm:$src, 1))]>; def LXSIHZX : X_XT6_RA5_RB5<31, 813, "lxsihzx", vsfrc, - [(set f64:$XT, (PPClxsizx xoaddr:$src, 2))]>; + [(set f64:$XT, (PPClxsizx ForceXForm:$src, 2))]>; // Load Vector Halfword*8/Byte*16 Indexed def LXVH8X : X_XT6_RA5_RB5<31, 812, "lxvh8x" , vsrc, []>; @@ -1690,7 +1690,7 @@ // Load Vector Indexed def LXVX : X_XT6_RA5_RB5<31, 268, "lxvx" , vsrc, - [(set v2f64:$XT, (load xaddrX16:$src))]>; + [(set v2f64:$XT, (load XForm:$src))]>; // Load Vector (Left-justified) with Length def LXVL : XX1Form_memOp<31, 269, (outs vsrc:$XT), (ins memr:$src, g8rc:$rB), "lxvl $XT, $src, $rB", IIC_LdStLoad, @@ -1718,9 +1718,9 @@ // Store as Integer Byte/Halfword Indexed def STXSIBX : X_XS6_RA5_RB5<31, 909, "stxsibx" , vsfrc, - [(PPCstxsix f64:$XT, xoaddr:$dst, 1)]>; + [(PPCstxsix f64:$XT, ForceXForm:$dst, 1)]>; def STXSIHX : X_XS6_RA5_RB5<31, 941, "stxsihx" , vsfrc, - [(PPCstxsix f64:$XT, xoaddr:$dst, 2)]>; + [(PPCstxsix f64:$XT, ForceXForm:$dst, 2)]>; let isCodeGenOnly = 1 in { def STXSIBXv : X_XS6_RA5_RB5<31, 909, "stxsibx" , vsrc, []>; def STXSIHXv : X_XS6_RA5_RB5<31, 941, "stxsihx" , vsrc, []>; @@ -1732,7 +1732,7 @@ // Store Vector Indexed def STXVX : X_XS6_RA5_RB5<31, 396, "stxvx" , vsrc, - [(store v2f64:$XT, xaddrX16:$dst)]>; + [(store v2f64:$XT, XForm:$dst)]>; // Store Vector (Left-justified) with Length def STXVL : XX1Form_memOp<31, 397, (outs), @@ -1749,16 +1749,16 @@ def DFLOADf32 : PPCPostRAExpPseudo<(outs vssrc:$XT), (ins memrix:$src), "#DFLOADf32", - [(set f32:$XT, (load iaddrX4:$src))]>; + [(set f32:$XT, (load DSForm:$src))]>; def DFLOADf64 : PPCPostRAExpPseudo<(outs vsfrc:$XT), (ins memrix:$src), "#DFLOADf64", - [(set f64:$XT, (load iaddrX4:$src))]>; + [(set f64:$XT, (load DSForm:$src))]>; def DFSTOREf32 : PPCPostRAExpPseudo<(outs), (ins vssrc:$XT, memrix:$dst), "#DFSTOREf32", - [(store f32:$XT, iaddrX4:$dst)]>; + [(store f32:$XT, DSForm:$dst)]>; def DFSTOREf64 : PPCPostRAExpPseudo<(outs), (ins vsfrc:$XT, memrix:$dst), "#DFSTOREf64", - [(store f64:$XT, iaddrX4:$dst)]>; + [(store f64:$XT, DSForm:$dst)]>; let mayStore = 1 in { def SPILLTOVSR_STX : PseudoXFormMemOp<(outs), @@ -1821,19 +1821,19 @@ } def ScalarLoads { - dag Li8 = (i32 (extloadi8 xoaddr:$src)); - dag ZELi8 = (i32 (zextloadi8 xoaddr:$src)); - dag ZELi8i64 = (i64 (zextloadi8 xoaddr:$src)); - dag SELi8 = (i32 (sext_inreg (extloadi8 xoaddr:$src), i8)); - dag SELi8i64 = (i64 (sext_inreg (extloadi8 xoaddr:$src), i8)); - - dag Li16 = (i32 (extloadi16 xoaddr:$src)); - dag ZELi16 = (i32 (zextloadi16 xoaddr:$src)); - dag ZELi16i64 = (i64 (zextloadi16 xoaddr:$src)); - dag SELi16 = (i32 (sextloadi16 xoaddr:$src)); - dag SELi16i64 = (i64 (sextloadi16 xoaddr:$src)); - - dag Li32 = (i32 (load xoaddr:$src)); + dag Li8 = (i32 (extloadi8 ForceXForm:$src)); + dag ZELi8 = (i32 (zextloadi8 ForceXForm:$src)); + dag ZELi8i64 = (i64 (zextloadi8 ForceXForm:$src)); + dag SELi8 = (i32 (sext_inreg (extloadi8 ForceXForm:$src), i8)); + dag SELi8i64 = (i64 (sext_inreg (extloadi8 ForceXForm:$src), i8)); + + dag Li16 = (i32 (extloadi16 ForceXForm:$src)); + dag ZELi16 = (i32 (zextloadi16 ForceXForm:$src)); + dag ZELi16i64 = (i64 (zextloadi16 ForceXForm:$src)); + dag SELi16 = (i32 (sextloadi16 ForceXForm:$src)); + dag SELi16i64 = (i64 (sextloadi16 ForceXForm:$src)); + + dag Li32 = (i32 (load ForceXForm:$src)); } def DWToSPExtractConv { @@ -2271,22 +2271,22 @@ } def FltToIntLoad { - dag A = (i32 (PPCmfvsr (PPCfctiwz (f64 (extloadf32 xoaddr:$A))))); + dag A = (i32 (PPCmfvsr (PPCfctiwz (f64 (extloadf32 ForceXForm:$A))))); } def FltToUIntLoad { - dag A = (i32 (PPCmfvsr (PPCfctiwuz (f64 (extloadf32 xoaddr:$A))))); + dag A = (i32 (PPCmfvsr (PPCfctiwuz (f64 (extloadf32 ForceXForm:$A))))); } def FltToLongLoad { - dag A = (i64 (PPCmfvsr (PPCfctidz (f64 (extloadf32 xoaddr:$A))))); + dag A = (i64 (PPCmfvsr (PPCfctidz (f64 (extloadf32 ForceXForm:$A))))); } def FltToLongLoadP9 { - dag A = (i64 (PPCmfvsr (PPCfctidz (f64 (extloadf32 iaddrX4:$A))))); + dag A = (i64 (PPCmfvsr (PPCfctidz (f64 (extloadf32 DSForm:$A))))); } def FltToULongLoad { - dag A = (i64 (PPCmfvsr (PPCfctiduz (f64 (extloadf32 xoaddr:$A))))); + dag A = (i64 (PPCmfvsr (PPCfctiduz (f64 (extloadf32 ForceXForm:$A))))); } def FltToULongLoadP9 { - dag A = (i64 (PPCmfvsr (PPCfctiduz (f64 (extloadf32 iaddrX4:$A))))); + dag A = (i64 (PPCmfvsr (PPCfctiduz (f64 (extloadf32 DSForm:$A))))); } def FltToLong { dag A = (i64 (PPCmfvsr (f64 (PPCfctidz (fpextend f32:$A))))); @@ -2313,38 +2313,38 @@ dag A = (i64 (PPCmfvsr (f64 (PPCfctiduz f64:$A)))); } def DblToIntLoad { - dag A = (i32 (PPCmfvsr (PPCfctiwz (f64 (load xoaddr:$A))))); + dag A = (i32 (PPCmfvsr (PPCfctiwz (f64 (load ForceXForm:$A))))); } def DblToIntLoadP9 { - dag A = (i32 (PPCmfvsr (PPCfctiwz (f64 (load iaddrX4:$A))))); + dag A = (i32 (PPCmfvsr (PPCfctiwz (f64 (load DSForm:$A))))); } def DblToUIntLoad { - dag A = (i32 (PPCmfvsr (PPCfctiwuz (f64 (load xoaddr:$A))))); + dag A = (i32 (PPCmfvsr (PPCfctiwuz (f64 (load ForceXForm:$A))))); } def DblToUIntLoadP9 { - dag A = (i32 (PPCmfvsr (PPCfctiwuz (f64 (load iaddrX4:$A))))); + dag A = (i32 (PPCmfvsr (PPCfctiwuz (f64 (load DSForm:$A))))); } def DblToLongLoad { - dag A = (i64 (PPCmfvsr (PPCfctidz (f64 (load xoaddr:$A))))); + dag A = (i64 (PPCmfvsr (PPCfctidz (f64 (load ForceXForm:$A))))); } def DblToULongLoad { - dag A = (i64 (PPCmfvsr (PPCfctiduz (f64 (load xoaddr:$A))))); + dag A = (i64 (PPCmfvsr (PPCfctiduz (f64 (load ForceXForm:$A))))); } // FP load dags (for f32 -> v4f32) def LoadFP { - dag A = (f32 (load xoaddr:$A)); - dag B = (f32 (load xoaddr:$B)); - dag C = (f32 (load xoaddr:$C)); - dag D = (f32 (load xoaddr:$D)); + dag A = (f32 (load ForceXForm:$A)); + dag B = (f32 (load ForceXForm:$B)); + dag C = (f32 (load ForceXForm:$C)); + dag D = (f32 (load ForceXForm:$D)); } // FP merge dags (for f32 -> v4f32) def MrgFP { - dag LD32A = (COPY_TO_REGCLASS (LIWZX xoaddr:$A), VSRC); - dag LD32B = (COPY_TO_REGCLASS (LIWZX xoaddr:$B), VSRC); - dag LD32C = (COPY_TO_REGCLASS (LIWZX xoaddr:$C), VSRC); - dag LD32D = (COPY_TO_REGCLASS (LIWZX xoaddr:$D), VSRC); + dag LD32A = (COPY_TO_REGCLASS (LIWZX ForceXForm:$A), VSRC); + dag LD32B = (COPY_TO_REGCLASS (LIWZX ForceXForm:$B), VSRC); + dag LD32C = (COPY_TO_REGCLASS (LIWZX ForceXForm:$C), VSRC); + dag LD32D = (COPY_TO_REGCLASS (LIWZX ForceXForm:$D), VSRC); dag AC = (XVCVDPSP (XXPERMDI (COPY_TO_REGCLASS $A, VSRC), (COPY_TO_REGCLASS $C, VSRC), 0)); dag BD = (XVCVDPSP (XXPERMDI (COPY_TO_REGCLASS $B, VSRC), @@ -2699,12 +2699,12 @@ def : Pat<(f64 (fmaxnum_ieee (fcanonicalize f64:$A), (fcanonicalize f64:$B))), (f64 (XSMAXDP $A, $B))>; -def : Pat<(int_ppc_vsx_stxvd2x_be v2f64:$rS, xoaddr:$dst), - (STXVD2X $rS, xoaddr:$dst)>; -def : Pat<(int_ppc_vsx_stxvw4x_be v4i32:$rS, xoaddr:$dst), - (STXVW4X $rS, xoaddr:$dst)>; -def : Pat<(v4i32 (int_ppc_vsx_lxvw4x_be xoaddr:$src)), (LXVW4X xoaddr:$src)>; -def : Pat<(v2f64 (int_ppc_vsx_lxvd2x_be xoaddr:$src)), (LXVD2X xoaddr:$src)>; +def : Pat<(int_ppc_vsx_stxvd2x_be v2f64:$rS, ForceXForm:$dst), + (STXVD2X $rS, ForceXForm:$dst)>; +def : Pat<(int_ppc_vsx_stxvw4x_be v4i32:$rS, ForceXForm:$dst), + (STXVW4X $rS, ForceXForm:$dst)>; +def : Pat<(v4i32 (int_ppc_vsx_lxvw4x_be ForceXForm:$src)), (LXVW4X ForceXForm:$src)>; +def : Pat<(v2f64 (int_ppc_vsx_lxvd2x_be ForceXForm:$src)), (LXVD2X ForceXForm:$src)>; // Rounding for single precision. def : Pat<(f32 (any_fround f32:$S)), @@ -2750,18 +2750,18 @@ (COPY_TO_REGCLASS (XSCVDPUXDS $A), VSRC), 0))>; defm : ScalToVecWPermute< v4i32, FltToIntLoad.A, - (XXSPLTW (COPY_TO_REGCLASS (XSCVDPSXWSs (XFLOADf32 xoaddr:$A)), VSRC), 1), - (COPY_TO_REGCLASS (XSCVDPSXWSs (XFLOADf32 xoaddr:$A)), VSRC)>; + (XXSPLTW (COPY_TO_REGCLASS (XSCVDPSXWSs (XFLOADf32 ForceXForm:$A)), VSRC), 1), + (COPY_TO_REGCLASS (XSCVDPSXWSs (XFLOADf32 ForceXForm:$A)), VSRC)>; defm : ScalToVecWPermute< v4i32, FltToUIntLoad.A, - (XXSPLTW (COPY_TO_REGCLASS (XSCVDPUXWSs (XFLOADf32 xoaddr:$A)), VSRC), 1), - (COPY_TO_REGCLASS (XSCVDPUXWSs (XFLOADf32 xoaddr:$A)), VSRC)>; + (XXSPLTW (COPY_TO_REGCLASS (XSCVDPUXWSs (XFLOADf32 ForceXForm:$A)), VSRC), 1), + (COPY_TO_REGCLASS (XSCVDPUXWSs (XFLOADf32 ForceXForm:$A)), VSRC)>; def : Pat<(v4f32 (build_vector f32:$A, f32:$A, f32:$A, f32:$A)), (v4f32 (XXSPLTW (v4f32 (XSCVDPSPN $A)), 0))>; -def : Pat<(v2f64 (PPCldsplat xoaddr:$A)), - (v2f64 (LXVDSX xoaddr:$A))>; -def : Pat<(v2i64 (PPCldsplat xoaddr:$A)), - (v2i64 (LXVDSX xoaddr:$A))>; +def : Pat<(v2f64 (PPCldsplat ForceXForm:$A)), + (v2f64 (LXVDSX ForceXForm:$A))>; +def : Pat<(v2i64 (PPCldsplat ForceXForm:$A)), + (v2i64 (LXVDSX ForceXForm:$A))>; // Build vectors of floating point converted to i64. def : Pat<(v2i64 (build_vector FltToLong.A, FltToLong.A)), @@ -2772,10 +2772,10 @@ (COPY_TO_REGCLASS (XSCVDPUXDSs $A), VSFRC), 0))>; defm : ScalToVecWPermute< v2i64, DblToLongLoad.A, - (XVCVDPSXDS (LXVDSX xoaddr:$A)), (XVCVDPSXDS (LXVDSX xoaddr:$A))>; + (XVCVDPSXDS (LXVDSX ForceXForm:$A)), (XVCVDPSXDS (LXVDSX ForceXForm:$A))>; defm : ScalToVecWPermute< v2i64, DblToULongLoad.A, - (XVCVDPUXDS (LXVDSX xoaddr:$A)), (XVCVDPUXDS (LXVDSX xoaddr:$A))>; + (XVCVDPUXDS (LXVDSX ForceXForm:$A)), (XVCVDPUXDS (LXVDSX ForceXForm:$A))>; } // HasVSX // Any big endian VSX subtarget. @@ -2883,14 +2883,14 @@ def : Pat<(f64 (extractelt v2f64:$S, 1)), (f64 (EXTRACT_SUBREG $S, sub_64))>; -def : Pat<(v2f64 (PPCld_vec_be xoaddr:$src)), (LXVD2X xoaddr:$src)>; -def : Pat<(PPCst_vec_be v2f64:$rS, xoaddr:$dst), (STXVD2X $rS, xoaddr:$dst)>; -def : Pat<(v4f32 (PPCld_vec_be xoaddr:$src)), (LXVW4X xoaddr:$src)>; -def : Pat<(PPCst_vec_be v4f32:$rS, xoaddr:$dst), (STXVW4X $rS, xoaddr:$dst)>; -def : Pat<(v2i64 (PPCld_vec_be xoaddr:$src)), (LXVD2X xoaddr:$src)>; -def : Pat<(PPCst_vec_be v2i64:$rS, xoaddr:$dst), (STXVD2X $rS, xoaddr:$dst)>; -def : Pat<(v4i32 (PPCld_vec_be xoaddr:$src)), (LXVW4X xoaddr:$src)>; -def : Pat<(PPCst_vec_be v4i32:$rS, xoaddr:$dst), (STXVW4X $rS, xoaddr:$dst)>; +def : Pat<(v2f64 (PPCld_vec_be ForceXForm:$src)), (LXVD2X ForceXForm:$src)>; +def : Pat<(PPCst_vec_be v2f64:$rS, ForceXForm:$dst), (STXVD2X $rS, ForceXForm:$dst)>; +def : Pat<(v4f32 (PPCld_vec_be ForceXForm:$src)), (LXVW4X ForceXForm:$src)>; +def : Pat<(PPCst_vec_be v4f32:$rS, ForceXForm:$dst), (STXVW4X $rS, ForceXForm:$dst)>; +def : Pat<(v2i64 (PPCld_vec_be ForceXForm:$src)), (LXVD2X ForceXForm:$src)>; +def : Pat<(PPCst_vec_be v2i64:$rS, ForceXForm:$dst), (STXVD2X $rS, ForceXForm:$dst)>; +def : Pat<(v4i32 (PPCld_vec_be ForceXForm:$src)), (LXVW4X ForceXForm:$src)>; +def : Pat<(PPCst_vec_be v4i32:$rS, ForceXForm:$dst), (STXVW4X $rS, ForceXForm:$dst)>; def : Pat<(f64 (PPCfcfid (PPCmtvsra (i64 (vector_extract v2i64:$S, 0))))), (f64 (XSCVSXDDP (COPY_TO_REGCLASS (XXPERMDI $S, $S, 2), VSFRC)))>; def : Pat<(f64 (PPCfcfid (PPCmtvsra (i64 (vector_extract v2i64:$S, 1))))), @@ -2979,30 +2979,30 @@ // Any pre-Power9 VSX subtarget. let Predicates = [HasVSX, NoP9Vector] in { def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), xoaddr:$dst, 8), - (STXSDX (XSCVDPSXDS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 8), + (STXSDX (XSCVDPSXDS f64:$src), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), xoaddr:$dst, 8), - (STXSDX (XSCVDPUXDS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 8), + (STXSDX (XSCVDPUXDS f64:$src), ForceXForm:$dst)>; // Load-and-splat with fp-to-int conversion (using X-Form VSX/FP loads). defm : ScalToVecWPermute< v4i32, DblToIntLoad.A, - (XXSPLTW (COPY_TO_REGCLASS (XSCVDPSXWS (XFLOADf64 xoaddr:$A)), VSRC), 1), - (COPY_TO_REGCLASS (XSCVDPSXWS (XFLOADf64 xoaddr:$A)), VSRC)>; + (XXSPLTW (COPY_TO_REGCLASS (XSCVDPSXWS (XFLOADf64 ForceXForm:$A)), VSRC), 1), + (COPY_TO_REGCLASS (XSCVDPSXWS (XFLOADf64 ForceXForm:$A)), VSRC)>; defm : ScalToVecWPermute< v4i32, DblToUIntLoad.A, - (XXSPLTW (COPY_TO_REGCLASS (XSCVDPUXWS (XFLOADf64 xoaddr:$A)), VSRC), 1), - (COPY_TO_REGCLASS (XSCVDPUXWS (XFLOADf64 xoaddr:$A)), VSRC)>; + (XXSPLTW (COPY_TO_REGCLASS (XSCVDPUXWS (XFLOADf64 ForceXForm:$A)), VSRC), 1), + (COPY_TO_REGCLASS (XSCVDPUXWS (XFLOADf64 ForceXForm:$A)), VSRC)>; defm : ScalToVecWPermute< v2i64, FltToLongLoad.A, - (XXPERMDIs (XSCVDPSXDS (COPY_TO_REGCLASS (XFLOADf32 xoaddr:$A), VSFRC)), 0), - (SUBREG_TO_REG (i64 1), (XSCVDPSXDS (COPY_TO_REGCLASS (XFLOADf32 xoaddr:$A), + (XXPERMDIs (XSCVDPSXDS (COPY_TO_REGCLASS (XFLOADf32 ForceXForm:$A), VSFRC)), 0), + (SUBREG_TO_REG (i64 1), (XSCVDPSXDS (COPY_TO_REGCLASS (XFLOADf32 ForceXForm:$A), VSFRC)), sub_64)>; defm : ScalToVecWPermute< v2i64, FltToULongLoad.A, - (XXPERMDIs (XSCVDPUXDS (COPY_TO_REGCLASS (XFLOADf32 xoaddr:$A), VSFRC)), 0), - (SUBREG_TO_REG (i64 1), (XSCVDPUXDS (COPY_TO_REGCLASS (XFLOADf32 xoaddr:$A), + (XXPERMDIs (XSCVDPUXDS (COPY_TO_REGCLASS (XFLOADf32 ForceXForm:$A), VSFRC)), 0), + (SUBREG_TO_REG (i64 1), (XSCVDPUXDS (COPY_TO_REGCLASS (XFLOADf32 ForceXForm:$A), VSFRC)), sub_64)>; } // HasVSX, NoP9Vector @@ -3010,48 +3010,48 @@ let Predicates = [HasVSX, NoP9Vector, IsLittleEndian] in { // Load-and-splat using only X-Form VSX loads. defm : ScalToVecWPermute< - v2i64, (i64 (load xoaddr:$src)), - (XXPERMDIs (XFLOADf64 xoaddr:$src), 2), - (SUBREG_TO_REG (i64 1), (XFLOADf64 xoaddr:$src), sub_64)>; + v2i64, (i64 (load ForceXForm:$src)), + (XXPERMDIs (XFLOADf64 ForceXForm:$src), 2), + (SUBREG_TO_REG (i64 1), (XFLOADf64 ForceXForm:$src), sub_64)>; defm : ScalToVecWPermute< - v2f64, (f64 (load xoaddr:$src)), - (XXPERMDIs (XFLOADf64 xoaddr:$src), 2), - (SUBREG_TO_REG (i64 1), (XFLOADf64 xoaddr:$src), sub_64)>; + v2f64, (f64 (load ForceXForm:$src)), + (XXPERMDIs (XFLOADf64 ForceXForm:$src), 2), + (SUBREG_TO_REG (i64 1), (XFLOADf64 ForceXForm:$src), sub_64)>; } // HasVSX, NoP9Vector, IsLittleEndian // Any VSX subtarget that only has loads and stores that load in big endian // order regardless of endianness. This is really pre-Power9 subtargets. let Predicates = [HasVSX, HasOnlySwappingMemOps] in { - def : Pat<(v2f64 (PPClxvd2x xoaddr:$src)), (LXVD2X xoaddr:$src)>; + def : Pat<(v2f64 (PPClxvd2x ForceXForm:$src)), (LXVD2X ForceXForm:$src)>; // Stores. - def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, xoaddr:$dst), - (STXVD2X $rS, xoaddr:$dst)>; - def : Pat<(PPCstxvd2x v2f64:$rS, xoaddr:$dst), (STXVD2X $rS, xoaddr:$dst)>; + def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, ForceXForm:$dst), + (STXVD2X $rS, ForceXForm:$dst)>; + def : Pat<(PPCstxvd2x v2f64:$rS, ForceXForm:$dst), (STXVD2X $rS, ForceXForm:$dst)>; } // HasVSX, HasOnlySwappingMemOps // Big endian VSX subtarget that only has loads and stores that always // load in big endian order. Really big endian pre-Power9 subtargets. let Predicates = [HasVSX, HasOnlySwappingMemOps, IsBigEndian] in { - def : Pat<(v2f64 (load xoaddr:$src)), (LXVD2X xoaddr:$src)>; - def : Pat<(v2i64 (load xoaddr:$src)), (LXVD2X xoaddr:$src)>; - def : Pat<(v4i32 (load xoaddr:$src)), (LXVW4X xoaddr:$src)>; - def : Pat<(v4i32 (int_ppc_vsx_lxvw4x xoaddr:$src)), (LXVW4X xoaddr:$src)>; - def : Pat<(store v2f64:$rS, xoaddr:$dst), (STXVD2X $rS, xoaddr:$dst)>; - def : Pat<(store v2i64:$rS, xoaddr:$dst), (STXVD2X $rS, xoaddr:$dst)>; - def : Pat<(store v4i32:$XT, xoaddr:$dst), (STXVW4X $XT, xoaddr:$dst)>; - def : Pat<(int_ppc_vsx_stxvw4x v4i32:$rS, xoaddr:$dst), - (STXVW4X $rS, xoaddr:$dst)>; + def : Pat<(v2f64 (load ForceXForm:$src)), (LXVD2X ForceXForm:$src)>; + def : Pat<(v2i64 (load ForceXForm:$src)), (LXVD2X ForceXForm:$src)>; + def : Pat<(v4i32 (load ForceXForm:$src)), (LXVW4X ForceXForm:$src)>; + def : Pat<(v4i32 (int_ppc_vsx_lxvw4x ForceXForm:$src)), (LXVW4X ForceXForm:$src)>; + def : Pat<(store v2f64:$rS, ForceXForm:$dst), (STXVD2X $rS, ForceXForm:$dst)>; + def : Pat<(store v2i64:$rS, ForceXForm:$dst), (STXVD2X $rS, ForceXForm:$dst)>; + def : Pat<(store v4i32:$XT, ForceXForm:$dst), (STXVW4X $XT, ForceXForm:$dst)>; + def : Pat<(int_ppc_vsx_stxvw4x v4i32:$rS, ForceXForm:$dst), + (STXVW4X $rS, ForceXForm:$dst)>; } // HasVSX, HasOnlySwappingMemOps, IsBigEndian // Any Power8 VSX subtarget. let Predicates = [HasVSX, HasP8Vector] in { def : Pat<(int_ppc_vsx_xxleqv v4i32:$A, v4i32:$B), (XXLEQV $A, $B)>; -def : Pat<(f64 (extloadf32 xoaddr:$src)), - (COPY_TO_REGCLASS (XFLOADf32 xoaddr:$src), VSFRC)>; -def : Pat<(f32 (fpround (f64 (extloadf32 xoaddr:$src)))), - (f32 (XFLOADf32 xoaddr:$src))>; +def : Pat<(f64 (extloadf32 ForceXForm:$src)), + (COPY_TO_REGCLASS (XFLOADf32 ForceXForm:$src), VSFRC)>; +def : Pat<(f32 (fpround (f64 (extloadf32 ForceXForm:$src)))), + (f32 (XFLOADf32 ForceXForm:$src))>; def : Pat<(f64 (any_fpextend f32:$src)), (COPY_TO_REGCLASS $src, VSFRC)>; @@ -3094,11 +3094,11 @@ // Instructions for converting float to i32 feeding a store. def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), xoaddr:$dst, 4), - (STIWX (XSCVDPSXWS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 4), + (STIWX (XSCVDPSXWS f64:$src), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), xoaddr:$dst, 4), - (STIWX (XSCVDPUXWS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 4), + (STIWX (XSCVDPUXWS f64:$src), ForceXForm:$dst)>; def : Pat<(v2i64 (smax v2i64:$src1, v2i64:$src2)), (v2i64 (VMAXSD (COPY_TO_REGCLASS $src1, VRRC), @@ -3168,16 +3168,16 @@ // LIWAX - This instruction is used for sign extending i32 -> i64. // LIWZX - This instruction will be emitted for i32, f32, and when // zero-extending i32 to i64 (zext i32 -> i64). -def : Pat<(v2i64 (scalar_to_vector (i64 (sextloadi32 xoaddr:$src)))), - (v2i64 (COPY_TO_REGCLASS (LIWAX xoaddr:$src), VSRC))>; -def : Pat<(v2i64 (scalar_to_vector (i64 (zextloadi32 xoaddr:$src)))), - (v2i64 (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC))>; -def : Pat<(v4i32 (scalar_to_vector (i32 (load xoaddr:$src)))), +def : Pat<(v2i64 (scalar_to_vector (i64 (sextloadi32 ForceXForm:$src)))), + (v2i64 (COPY_TO_REGCLASS (LIWAX ForceXForm:$src), VSRC))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (zextloadi32 ForceXForm:$src)))), + (v2i64 (COPY_TO_REGCLASS (LIWZX ForceXForm:$src), VSRC))>; +def : Pat<(v4i32 (scalar_to_vector (i32 (load ForceXForm:$src)))), (v4i32 (XXSLDWIs - (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 1))>; -def : Pat<(v4f32 (scalar_to_vector (f32 (load xoaddr:$src)))), + (COPY_TO_REGCLASS (LIWZX ForceXForm:$src), VSRC), 1))>; +def : Pat<(v4f32 (scalar_to_vector (f32 (load ForceXForm:$src)))), (v4f32 (XXSLDWIs - (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSRC), 1))>; + (COPY_TO_REGCLASS (LIWZX ForceXForm:$src), VSRC), 1))>; def : Pat; -def : Pat<(store (i32 (extractelt v4i32:$A, 1)), xoaddr:$src), - (STIWX (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; -def : Pat<(store (f32 (extractelt v4f32:$A, 1)), xoaddr:$src), - (STIWX (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; +def : Pat<(store (i32 (extractelt v4i32:$A, 1)), ForceXForm:$src), + (STIWX (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; +def : Pat<(store (f32 (extractelt v4f32:$A, 1)), ForceXForm:$src), + (STIWX (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; // Elements in a register on a BE system are in order <0, 1, 2, 3>. // The store instructions store the second word from the left. // So to align element zero, we need to modulo-left-shift by 3 words. // Similar logic applies for elements 2 and 3. foreach Idx = [ [0,3], [2,1], [3,2] ] in { - def : Pat<(store (i32 (extractelt v4i32:$A, !head(Idx))), xoaddr:$src), + def : Pat<(store (i32 (extractelt v4i32:$A, !head(Idx))), ForceXForm:$src), (STIWX (EXTRACT_SUBREG (XXSLDWI $A, $A, !head(!tail(Idx))), - sub_64), xoaddr:$src)>; - def : Pat<(store (f32 (extractelt v4f32:$A, !head(Idx))), xoaddr:$src), + sub_64), ForceXForm:$src)>; + def : Pat<(store (f32 (extractelt v4f32:$A, !head(Idx))), ForceXForm:$src), (STIWX (EXTRACT_SUBREG (XXSLDWI $A, $A, !head(!tail(Idx))), - sub_64), xoaddr:$src)>; + sub_64), ForceXForm:$src)>; } } // HasVSX, HasP8Vector, IsBigEndian, IsPPC64 @@ -3256,24 +3256,24 @@ // LIWZX - This instruction will be emitted for i32, f32, and when // zero-extending i32 to i64 (zext i32 -> i64). defm : ScalToVecWPermute< - v2i64, (i64 (sextloadi32 xoaddr:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (LIWAX xoaddr:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (LIWAX xoaddr:$src), sub_64)>; + v2i64, (i64 (sextloadi32 ForceXForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (LIWAX ForceXForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (LIWAX ForceXForm:$src), sub_64)>; defm : ScalToVecWPermute< - v2i64, (i64 (zextloadi32 xoaddr:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (LIWZX xoaddr:$src), sub_64)>; + v2i64, (i64 (zextloadi32 ForceXForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (LIWZX ForceXForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (LIWZX ForceXForm:$src), sub_64)>; defm : ScalToVecWPermute< - v4i32, (i32 (load xoaddr:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (LIWZX xoaddr:$src), sub_64)>; + v4i32, (i32 (load ForceXForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (LIWZX ForceXForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (LIWZX ForceXForm:$src), sub_64)>; defm : ScalToVecWPermute< - v4f32, (f32 (load xoaddr:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (LIWZX xoaddr:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (LIWZX xoaddr:$src), sub_64)>; + v4f32, (f32 (load ForceXForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (LIWZX ForceXForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (LIWZX ForceXForm:$src), sub_64)>; def : Pat; -def : Pat<(store (i32 (extractelt v4i32:$A, 2)), xoaddr:$src), - (STIWX (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; -def : Pat<(store (f32 (extractelt v4f32:$A, 2)), xoaddr:$src), - (STIWX (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; +def : Pat<(store (i32 (extractelt v4i32:$A, 2)), ForceXForm:$src), + (STIWX (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; +def : Pat<(store (f32 (extractelt v4f32:$A, 2)), ForceXForm:$src), + (STIWX (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; // Elements in a register on a LE system are in order <3, 2, 1, 0>. // The store instructions store the second word from the left. // So to align element 3, we need to modulo-left-shift by 3 words. // Similar logic applies for elements 0 and 1. foreach Idx = [ [0,2], [1,1], [3,3] ] in { - def : Pat<(store (i32 (extractelt v4i32:$A, !head(Idx))), xoaddr:$src), + def : Pat<(store (i32 (extractelt v4i32:$A, !head(Idx))), ForceXForm:$src), (STIWX (EXTRACT_SUBREG (XXSLDWI $A, $A, !head(!tail(Idx))), - sub_64), xoaddr:$src)>; - def : Pat<(store (f32 (extractelt v4f32:$A, !head(Idx))), xoaddr:$src), + sub_64), ForceXForm:$src)>; + def : Pat<(store (f32 (extractelt v4f32:$A, !head(Idx))), ForceXForm:$src), (STIWX (EXTRACT_SUBREG (XXSLDWI $A, $A, !head(!tail(Idx))), - sub_64), xoaddr:$src)>; + sub_64), ForceXForm:$src)>; } } // HasVSX, HasP8Vector, IsLittleEndian // Big endian pre-Power9 VSX subtarget. let Predicates = [HasVSX, HasP8Vector, NoP9Vector, IsBigEndian, IsPPC64] in { -def : Pat<(store (i64 (extractelt v2i64:$A, 0)), xoaddr:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 0)), xoaddr:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 1)), xoaddr:$src), +def : Pat<(store (i64 (extractelt v2i64:$A, 0)), ForceXForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 0)), ForceXForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 1)), ForceXForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), sub_64), - xoaddr:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 1)), xoaddr:$src), + ForceXForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 1)), ForceXForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), sub_64), - xoaddr:$src)>; + ForceXForm:$src)>; } // HasVSX, HasP8Vector, NoP9Vector, IsBigEndian, IsPPC64 // Little endian pre-Power9 VSX subtarget. let Predicates = [HasVSX, HasP8Vector, NoP9Vector, IsLittleEndian] in { -def : Pat<(store (i64 (extractelt v2i64:$A, 0)), xoaddr:$src), +def : Pat<(store (i64 (extractelt v2i64:$A, 0)), ForceXForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), sub_64), - xoaddr:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 0)), xoaddr:$src), + ForceXForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 0)), ForceXForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), sub_64), - xoaddr:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 1)), xoaddr:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 1)), xoaddr:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xoaddr:$src)>; + ForceXForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 1)), ForceXForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 1)), ForceXForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>; } // HasVSX, HasP8Vector, NoP9Vector, IsLittleEndian // Any VSX target with direct moves. @@ -3627,12 +3627,12 @@ // Convert (Un)Signed Word -> QP. def : Pat<(f128 (any_sint_to_fp i32:$src)), (f128 (XSCVSDQP (MTVSRWA $src)))>; -def : Pat<(f128 (any_sint_to_fp (i32 (load xoaddr:$src)))), - (f128 (XSCVSDQP (LIWAX xoaddr:$src)))>; +def : Pat<(f128 (any_sint_to_fp (i32 (load ForceXForm:$src)))), + (f128 (XSCVSDQP (LIWAX ForceXForm:$src)))>; def : Pat<(f128 (any_uint_to_fp i32:$src)), (f128 (XSCVUDQP (MTVSRWZ $src)))>; -def : Pat<(f128 (any_uint_to_fp (i32 (load xoaddr:$src)))), - (f128 (XSCVUDQP (LIWZX xoaddr:$src)))>; +def : Pat<(f128 (any_uint_to_fp (i32 (load ForceXForm:$src)))), + (f128 (XSCVUDQP (LIWZX ForceXForm:$src)))>; // Pattern for matching Vector HP -> Vector SP intrinsic. Defined as a // separate pattern so that it can convert the input register class from @@ -3673,95 +3673,95 @@ (v1i128 (COPY_TO_REGCLASS (XXBRQ (COPY_TO_REGCLASS $A, VSRC)), VRRC))>; // D-Form Load/Store -def : Pat<(v4i32 (quadwOffsetLoad iaddrX16:$src)), (LXV memrix16:$src)>; -def : Pat<(v4f32 (quadwOffsetLoad iaddrX16:$src)), (LXV memrix16:$src)>; -def : Pat<(v2i64 (quadwOffsetLoad iaddrX16:$src)), (LXV memrix16:$src)>; -def : Pat<(v2f64 (quadwOffsetLoad iaddrX16:$src)), (LXV memrix16:$src)>; -def : Pat<(f128 (quadwOffsetLoad iaddrX16:$src)), +def : Pat<(v4i32 (quadwOffsetLoad DQForm:$src)), (LXV memrix16:$src)>; +def : Pat<(v4f32 (quadwOffsetLoad DQForm:$src)), (LXV memrix16:$src)>; +def : Pat<(v2i64 (quadwOffsetLoad DQForm:$src)), (LXV memrix16:$src)>; +def : Pat<(v2f64 (quadwOffsetLoad DQForm:$src)), (LXV memrix16:$src)>; +def : Pat<(f128 (quadwOffsetLoad DQForm:$src)), (COPY_TO_REGCLASS (LXV memrix16:$src), VRRC)>; -def : Pat<(v4i32 (int_ppc_vsx_lxvw4x iaddrX16:$src)), (LXV memrix16:$src)>; -def : Pat<(v2f64 (int_ppc_vsx_lxvd2x iaddrX16:$src)), (LXV memrix16:$src)>; +def : Pat<(v4i32 (int_ppc_vsx_lxvw4x DQForm:$src)), (LXV memrix16:$src)>; +def : Pat<(v2f64 (int_ppc_vsx_lxvd2x DQForm:$src)), (LXV memrix16:$src)>; -def : Pat<(quadwOffsetStore v4f32:$rS, iaddrX16:$dst), (STXV $rS, memrix16:$dst)>; -def : Pat<(quadwOffsetStore v4i32:$rS, iaddrX16:$dst), (STXV $rS, memrix16:$dst)>; -def : Pat<(quadwOffsetStore v2f64:$rS, iaddrX16:$dst), (STXV $rS, memrix16:$dst)>; -def : Pat<(quadwOffsetStore f128:$rS, iaddrX16:$dst), +def : Pat<(quadwOffsetStore v4f32:$rS, DQForm:$dst), (STXV $rS, memrix16:$dst)>; +def : Pat<(quadwOffsetStore v4i32:$rS, DQForm:$dst), (STXV $rS, memrix16:$dst)>; +def : Pat<(quadwOffsetStore v2f64:$rS, DQForm:$dst), (STXV $rS, memrix16:$dst)>; +def : Pat<(quadwOffsetStore f128:$rS, DQForm:$dst), (STXV (COPY_TO_REGCLASS $rS, VSRC), memrix16:$dst)>; -def : Pat<(quadwOffsetStore v2i64:$rS, iaddrX16:$dst), (STXV $rS, memrix16:$dst)>; -def : Pat<(int_ppc_vsx_stxvw4x v4i32:$rS, iaddrX16:$dst), +def : Pat<(quadwOffsetStore v2i64:$rS, DQForm:$dst), (STXV $rS, memrix16:$dst)>; +def : Pat<(int_ppc_vsx_stxvw4x v4i32:$rS, DQForm:$dst), (STXV $rS, memrix16:$dst)>; -def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, iaddrX16:$dst), +def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, DQForm:$dst), (STXV $rS, memrix16:$dst)>; -def : Pat<(v2f64 (nonQuadwOffsetLoad xoaddr:$src)), (LXVX xoaddr:$src)>; -def : Pat<(v2i64 (nonQuadwOffsetLoad xoaddr:$src)), (LXVX xoaddr:$src)>; -def : Pat<(v4f32 (nonQuadwOffsetLoad xoaddr:$src)), (LXVX xoaddr:$src)>; -def : Pat<(v4i32 (nonQuadwOffsetLoad xoaddr:$src)), (LXVX xoaddr:$src)>; -def : Pat<(v4i32 (int_ppc_vsx_lxvw4x xoaddr:$src)), (LXVX xoaddr:$src)>; -def : Pat<(v2f64 (int_ppc_vsx_lxvd2x xoaddr:$src)), (LXVX xoaddr:$src)>; -def : Pat<(f128 (nonQuadwOffsetLoad xoaddr:$src)), - (COPY_TO_REGCLASS (LXVX xoaddr:$src), VRRC)>; -def : Pat<(nonQuadwOffsetStore f128:$rS, xoaddr:$dst), - (STXVX (COPY_TO_REGCLASS $rS, VSRC), xoaddr:$dst)>; -def : Pat<(nonQuadwOffsetStore v2f64:$rS, xoaddr:$dst), - (STXVX $rS, xoaddr:$dst)>; -def : Pat<(nonQuadwOffsetStore v2i64:$rS, xoaddr:$dst), - (STXVX $rS, xoaddr:$dst)>; -def : Pat<(nonQuadwOffsetStore v4f32:$rS, xoaddr:$dst), - (STXVX $rS, xoaddr:$dst)>; -def : Pat<(nonQuadwOffsetStore v4i32:$rS, xoaddr:$dst), - (STXVX $rS, xoaddr:$dst)>; -def : Pat<(int_ppc_vsx_stxvw4x v4i32:$rS, xoaddr:$dst), - (STXVX $rS, xoaddr:$dst)>; -def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, xoaddr:$dst), - (STXVX $rS, xoaddr:$dst)>; +def : Pat<(v2f64 (nonQuadwOffsetLoad ForceXForm:$src)), (LXVX ForceXForm:$src)>; +def : Pat<(v2i64 (nonQuadwOffsetLoad ForceXForm:$src)), (LXVX ForceXForm:$src)>; +def : Pat<(v4f32 (nonQuadwOffsetLoad ForceXForm:$src)), (LXVX ForceXForm:$src)>; +def : Pat<(v4i32 (nonQuadwOffsetLoad ForceXForm:$src)), (LXVX ForceXForm:$src)>; +def : Pat<(v4i32 (int_ppc_vsx_lxvw4x ForceXForm:$src)), (LXVX ForceXForm:$src)>; +def : Pat<(v2f64 (int_ppc_vsx_lxvd2x ForceXForm:$src)), (LXVX ForceXForm:$src)>; +def : Pat<(f128 (nonQuadwOffsetLoad ForceXForm:$src)), + (COPY_TO_REGCLASS (LXVX ForceXForm:$src), VRRC)>; +def : Pat<(nonQuadwOffsetStore f128:$rS, ForceXForm:$dst), + (STXVX (COPY_TO_REGCLASS $rS, VSRC), ForceXForm:$dst)>; +def : Pat<(nonQuadwOffsetStore v2f64:$rS, ForceXForm:$dst), + (STXVX $rS, ForceXForm:$dst)>; +def : Pat<(nonQuadwOffsetStore v2i64:$rS, ForceXForm:$dst), + (STXVX $rS, ForceXForm:$dst)>; +def : Pat<(nonQuadwOffsetStore v4f32:$rS, ForceXForm:$dst), + (STXVX $rS, ForceXForm:$dst)>; +def : Pat<(nonQuadwOffsetStore v4i32:$rS, ForceXForm:$dst), + (STXVX $rS, ForceXForm:$dst)>; +def : Pat<(int_ppc_vsx_stxvw4x v4i32:$rS, ForceXForm:$dst), + (STXVX $rS, ForceXForm:$dst)>; +def : Pat<(int_ppc_vsx_stxvd2x v2f64:$rS, ForceXForm:$dst), + (STXVX $rS, ForceXForm:$dst)>; // Build vectors from i8 loads defm : ScalToVecWPermute; + (VSPLTBs 7, (LXSIBZX ForceXForm:$src)), + (VSPLTBs 7, (LXSIBZX ForceXForm:$src))>; defm : ScalToVecWPermute; + (VSPLTHs 3, (LXSIBZX ForceXForm:$src)), + (VSPLTHs 3, (LXSIBZX ForceXForm:$src))>; defm : ScalToVecWPermute; + (XXSPLTWs (LXSIBZX ForceXForm:$src), 1), + (XXSPLTWs (LXSIBZX ForceXForm:$src), 1)>; defm : ScalToVecWPermute; + (XXPERMDIs (LXSIBZX ForceXForm:$src), 0), + (XXPERMDIs (LXSIBZX ForceXForm:$src), 0)>; defm : ScalToVecWPermute; + (XXSPLTWs (VEXTSB2Ws (LXSIBZX ForceXForm:$src)), 1), + (XXSPLTWs (VEXTSB2Ws (LXSIBZX ForceXForm:$src)), 1)>; defm : ScalToVecWPermute; + (XXPERMDIs (VEXTSB2Ds (LXSIBZX ForceXForm:$src)), 0), + (XXPERMDIs (VEXTSB2Ds (LXSIBZX ForceXForm:$src)), 0)>; // Build vectors from i16 loads defm : ScalToVecWPermute; + (VSPLTHs 3, (LXSIHZX ForceXForm:$src)), + (VSPLTHs 3, (LXSIHZX ForceXForm:$src))>; defm : ScalToVecWPermute; + (XXSPLTWs (LXSIHZX ForceXForm:$src), 1), + (XXSPLTWs (LXSIHZX ForceXForm:$src), 1)>; defm : ScalToVecWPermute; + (XXPERMDIs (LXSIHZX ForceXForm:$src), 0), + (XXPERMDIs (LXSIHZX ForceXForm:$src), 0)>; defm : ScalToVecWPermute; + (XXSPLTWs (VEXTSH2Ws (LXSIHZX ForceXForm:$src)), 1), + (XXSPLTWs (VEXTSH2Ws (LXSIHZX ForceXForm:$src)), 1)>; defm : ScalToVecWPermute; + (XXPERMDIs (VEXTSH2Ds (LXSIHZX ForceXForm:$src)), 0), + (XXPERMDIs (VEXTSH2Ds (LXSIHZX ForceXForm:$src)), 0)>; // Load/convert and convert/store patterns for f16. -def : Pat<(f64 (extloadf16 xoaddr:$src)), - (f64 (XSCVHPDP (LXSIHZX xoaddr:$src)))>; -def : Pat<(truncstoref16 f64:$src, xoaddr:$dst), - (STXSIHX (XSCVDPHP $src), xoaddr:$dst)>; -def : Pat<(f32 (extloadf16 xoaddr:$src)), - (f32 (COPY_TO_REGCLASS (XSCVHPDP (LXSIHZX xoaddr:$src)), VSSRC))>; -def : Pat<(truncstoref16 f32:$src, xoaddr:$dst), - (STXSIHX (XSCVDPHP (COPY_TO_REGCLASS $src, VSFRC)), xoaddr:$dst)>; +def : Pat<(f64 (extloadf16 ForceXForm:$src)), + (f64 (XSCVHPDP (LXSIHZX ForceXForm:$src)))>; +def : Pat<(truncstoref16 f64:$src, ForceXForm:$dst), + (STXSIHX (XSCVDPHP $src), ForceXForm:$dst)>; +def : Pat<(f32 (extloadf16 ForceXForm:$src)), + (f32 (COPY_TO_REGCLASS (XSCVHPDP (LXSIHZX ForceXForm:$src)), VSSRC))>; +def : Pat<(truncstoref16 f32:$src, ForceXForm:$dst), + (STXSIHX (XSCVDPHP (COPY_TO_REGCLASS $src, VSFRC)), ForceXForm:$dst)>; def : Pat<(f64 (f16_to_fp i32:$A)), (f64 (XSCVHPDP (MTVSRWZ $A)))>; def : Pat<(f32 (f16_to_fp i32:$A)), @@ -3776,33 +3776,33 @@ def : Pat<(f64 (PPCVexts f64:$A, 2)), (f64 (COPY_TO_REGCLASS (VEXTSH2Ds $A), VSFRC))>; -def : Pat<(f64 (extloadf32 iaddrX4:$src)), - (COPY_TO_REGCLASS (DFLOADf32 iaddrX4:$src), VSFRC)>; -def : Pat<(f32 (fpround (f64 (extloadf32 iaddrX4:$src)))), - (f32 (DFLOADf32 iaddrX4:$src))>; +def : Pat<(f64 (extloadf32 DSForm:$src)), + (COPY_TO_REGCLASS (DFLOADf32 DSForm:$src), VSFRC)>; +def : Pat<(f32 (fpround (f64 (extloadf32 DSForm:$src)))), + (f32 (DFLOADf32 DSForm:$src))>; -def : Pat<(v4f32 (PPCldvsxlh xaddr:$src)), - (COPY_TO_REGCLASS (XFLOADf64 xaddr:$src), VSRC)>; -def : Pat<(v4f32 (PPCldvsxlh iaddrX4:$src)), - (COPY_TO_REGCLASS (DFLOADf64 iaddrX4:$src), VSRC)>; +def : Pat<(v4f32 (PPCldvsxlh XForm:$src)), + (COPY_TO_REGCLASS (XFLOADf64 XForm:$src), VSRC)>; +def : Pat<(v4f32 (PPCldvsxlh DSForm:$src)), + (COPY_TO_REGCLASS (DFLOADf64 DSForm:$src), VSRC)>; // Convert (Un)Signed DWord in memory -> QP -def : Pat<(f128 (sint_to_fp (i64 (load xaddrX4:$src)))), - (f128 (XSCVSDQP (LXSDX xaddrX4:$src)))>; -def : Pat<(f128 (sint_to_fp (i64 (load iaddrX4:$src)))), - (f128 (XSCVSDQP (LXSD iaddrX4:$src)))>; -def : Pat<(f128 (uint_to_fp (i64 (load xaddrX4:$src)))), - (f128 (XSCVUDQP (LXSDX xaddrX4:$src)))>; -def : Pat<(f128 (uint_to_fp (i64 (load iaddrX4:$src)))), - (f128 (XSCVUDQP (LXSD iaddrX4:$src)))>; +def : Pat<(f128 (sint_to_fp (i64 (load XForm:$src)))), + (f128 (XSCVSDQP (LXSDX XForm:$src)))>; +def : Pat<(f128 (sint_to_fp (i64 (load DSForm:$src)))), + (f128 (XSCVSDQP (LXSD DSForm:$src)))>; +def : Pat<(f128 (uint_to_fp (i64 (load XForm:$src)))), + (f128 (XSCVUDQP (LXSDX XForm:$src)))>; +def : Pat<(f128 (uint_to_fp (i64 (load DSForm:$src)))), + (f128 (XSCVUDQP (LXSD DSForm:$src)))>; // Convert Unsigned HWord in memory -> QP def : Pat<(f128 (uint_to_fp ScalarLoads.ZELi16)), - (f128 (XSCVUDQP (LXSIHZX xaddr:$src)))>; + (f128 (XSCVUDQP (LXSIHZX XForm:$src)))>; // Convert Unsigned Byte in memory -> QP def : Pat<(f128 (uint_to_fp ScalarLoads.ZELi8)), - (f128 (XSCVUDQP (LXSIBZX xoaddr:$src)))>; + (f128 (XSCVUDQP (LXSIBZX ForceXForm:$src)))>; // Truncate & Convert QP -> (Un)Signed (D)Word. def : Pat<(i64 (any_fp_to_sint f128:$src)), (i64 (MFVRD (XSCVQPSDZ $src)))>; @@ -3815,65 +3815,65 @@ // Instructions for store(fptosi). // The 8-byte version is repeated here due to availability of D-Form STXSD. def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), xaddrX4:$dst, 8), + (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), XForm:$dst, 8), (STXSDX (COPY_TO_REGCLASS (XSCVQPSDZ f128:$src), VFRC), - xaddrX4:$dst)>; + XForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), iaddrX4:$dst, 8), + (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), DSForm:$dst, 8), (STXSD (COPY_TO_REGCLASS (XSCVQPSDZ f128:$src), VFRC), - iaddrX4:$dst)>; + DSForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), xoaddr:$dst, 4), - (STXSIWX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), ForceXForm:$dst, 4), + (STXSIWX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), xoaddr:$dst, 2), - (STXSIHX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), ForceXForm:$dst, 2), + (STXSIHX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), xoaddr:$dst, 1), - (STXSIBX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), ForceXForm:$dst, 1), + (STXSIBX (COPY_TO_REGCLASS (XSCVQPSWZ $src), VFRC), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), xaddrX4:$dst, 8), - (STXSDX (XSCVDPSXDS f64:$src), xaddrX4:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), XForm:$dst, 8), + (STXSDX (XSCVDPSXDS f64:$src), XForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), iaddrX4:$dst, 8), - (STXSD (XSCVDPSXDS f64:$src), iaddrX4:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), DSForm:$dst, 8), + (STXSD (XSCVDPSXDS f64:$src), DSForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), xoaddr:$dst, 2), - (STXSIHX (XSCVDPSXWS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 2), + (STXSIHX (XSCVDPSXWS f64:$src), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), xoaddr:$dst, 1), - (STXSIBX (XSCVDPSXWS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), ForceXForm:$dst, 1), + (STXSIBX (XSCVDPSXWS f64:$src), ForceXForm:$dst)>; // Instructions for store(fptoui). def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), xaddrX4:$dst, 8), + (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), XForm:$dst, 8), (STXSDX (COPY_TO_REGCLASS (XSCVQPUDZ f128:$src), VFRC), - xaddrX4:$dst)>; + XForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), iaddrX4:$dst, 8), + (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), DSForm:$dst, 8), (STXSD (COPY_TO_REGCLASS (XSCVQPUDZ f128:$src), VFRC), - iaddrX4:$dst)>; + DSForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), xoaddr:$dst, 4), - (STXSIWX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), ForceXForm:$dst, 4), + (STXSIWX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), xoaddr:$dst, 2), - (STXSIHX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), ForceXForm:$dst, 2), + (STXSIHX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), xoaddr:$dst, 1), - (STXSIBX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), ForceXForm:$dst, 1), + (STXSIBX (COPY_TO_REGCLASS (XSCVQPUWZ $src), VFRC), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), xaddrX4:$dst, 8), - (STXSDX (XSCVDPUXDS f64:$src), xaddrX4:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), XForm:$dst, 8), + (STXSDX (XSCVDPUXDS f64:$src), XForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), iaddrX4:$dst, 8), - (STXSD (XSCVDPUXDS f64:$src), iaddrX4:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), DSForm:$dst, 8), + (STXSD (XSCVDPUXDS f64:$src), DSForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), xoaddr:$dst, 2), - (STXSIHX (XSCVDPUXWS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 2), + (STXSIHX (XSCVDPUXWS f64:$src), ForceXForm:$dst)>; def : Pat<(PPCstore_scal_int_from_vsr - (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), xoaddr:$dst, 1), - (STXSIBX (XSCVDPUXWS f64:$src), xoaddr:$dst)>; + (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), ForceXForm:$dst, 1), + (STXSIBX (XSCVDPUXWS f64:$src), ForceXForm:$dst)>; // Round & Convert QP -> DP/SP def : Pat<(f64 (any_fpround f128:$src)), (f64 (XSCVQPDP $src))>; @@ -3906,35 +3906,35 @@ immNonAllOneAnyExt8:$A, immNonAllOneAnyExt8:$A)), (v16i8 (COPY_TO_REGCLASS (XXSPLTIB imm:$A), VSRC))>; defm : ScalToVecWPermute; + (XVCVSPSXWS (LXVWSX ForceXForm:$A)), + (XVCVSPSXWS (LXVWSX ForceXForm:$A))>; defm : ScalToVecWPermute; + (XVCVSPUXWS (LXVWSX ForceXForm:$A)), + (XVCVSPUXWS (LXVWSX ForceXForm:$A))>; defm : ScalToVecWPermute< v4i32, DblToIntLoadP9.A, - (XXSPLTW (COPY_TO_REGCLASS (XSCVDPSXWS (DFLOADf64 iaddrX4:$A)), VSRC), 1), - (SUBREG_TO_REG (i64 1), (XSCVDPSXWS (DFLOADf64 iaddrX4:$A)), sub_64)>; + (XXSPLTW (COPY_TO_REGCLASS (XSCVDPSXWS (DFLOADf64 DSForm:$A)), VSRC), 1), + (SUBREG_TO_REG (i64 1), (XSCVDPSXWS (DFLOADf64 DSForm:$A)), sub_64)>; defm : ScalToVecWPermute< v4i32, DblToUIntLoadP9.A, - (XXSPLTW (COPY_TO_REGCLASS (XSCVDPUXWS (DFLOADf64 iaddrX4:$A)), VSRC), 1), - (SUBREG_TO_REG (i64 1), (XSCVDPUXWS (DFLOADf64 iaddrX4:$A)), sub_64)>; + (XXSPLTW (COPY_TO_REGCLASS (XSCVDPUXWS (DFLOADf64 DSForm:$A)), VSRC), 1), + (SUBREG_TO_REG (i64 1), (XSCVDPUXWS (DFLOADf64 DSForm:$A)), sub_64)>; defm : ScalToVecWPermute< v2i64, FltToLongLoadP9.A, - (XXPERMDIs (XSCVDPSXDS (COPY_TO_REGCLASS (DFLOADf32 iaddrX4:$A), VSFRC)), 0), + (XXPERMDIs (XSCVDPSXDS (COPY_TO_REGCLASS (DFLOADf32 DSForm:$A), VSFRC)), 0), (SUBREG_TO_REG (i64 1), - (XSCVDPSXDS (COPY_TO_REGCLASS (DFLOADf32 iaddrX4:$A), VSFRC)), sub_64)>; + (XSCVDPSXDS (COPY_TO_REGCLASS (DFLOADf32 DSForm:$A), VSFRC)), sub_64)>; defm : ScalToVecWPermute< v2i64, FltToULongLoadP9.A, - (XXPERMDIs (XSCVDPUXDS (COPY_TO_REGCLASS (DFLOADf32 iaddrX4:$A), VSFRC)), 0), + (XXPERMDIs (XSCVDPUXDS (COPY_TO_REGCLASS (DFLOADf32 DSForm:$A), VSFRC)), 0), (SUBREG_TO_REG (i64 1), - (XSCVDPUXDS (COPY_TO_REGCLASS (DFLOADf32 iaddrX4:$A), VSFRC)), sub_64)>; -def : Pat<(v4f32 (PPCldsplat xoaddr:$A)), - (v4f32 (LXVWSX xoaddr:$A))>; -def : Pat<(v4i32 (PPCldsplat xoaddr:$A)), - (v4i32 (LXVWSX xoaddr:$A))>; + (XSCVDPUXDS (COPY_TO_REGCLASS (DFLOADf32 DSForm:$A), VSFRC)), sub_64)>; +def : Pat<(v4f32 (PPCldsplat ForceXForm:$A)), + (v4f32 (LXVWSX ForceXForm:$A))>; +def : Pat<(v4i32 (PPCldsplat ForceXForm:$A)), + (v4i32 (LXVWSX ForceXForm:$A))>; } // HasVSX, HasP9Vector // Big endian 64Bit Power9 subtarget. @@ -3973,86 +3973,86 @@ (v4f32 (XXINSERTW v4f32:$A, AlignValues.F32_TO_BE_WORD1, 12))>; // Scalar stores of i8 -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 0)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 9)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 1)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 2)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 11)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 3)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 4)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 13)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 5)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 6)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 15)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 7)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS $S, VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 8)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 1)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 9)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 10)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 3)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 11)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 12)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 5)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 13)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 14)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 7)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 15)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), xoaddr:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 0)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 9)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 1)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 2)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 11)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 3)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 4)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 13)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 5)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 6)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 15)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 7)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS $S, VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 8)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 1)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 9)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 10)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 3)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 11)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 12)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 5)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 13)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 14)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 7)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 15)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), ForceXForm:$dst)>; // Scalar stores of i16 -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 0)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 1)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 2)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 3)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS $S, VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 4)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 5)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 6)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 7)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), xoaddr:$dst)>; - -def : Pat<(v2i64 (scalar_to_vector (i64 (load iaddrX4:$src)))), - (v2i64 (COPY_TO_REGCLASS (DFLOADf64 iaddrX4:$src), VSRC))>; -def : Pat<(v2i64 (scalar_to_vector (i64 (load xaddrX4:$src)))), - (v2i64 (COPY_TO_REGCLASS (XFLOADf64 xaddrX4:$src), VSRC))>; - -def : Pat<(v2f64 (scalar_to_vector (f64 (load iaddrX4:$src)))), - (v2f64 (COPY_TO_REGCLASS (DFLOADf64 iaddrX4:$src), VSRC))>; -def : Pat<(v2f64 (scalar_to_vector (f64 (load xaddrX4:$src)))), - (v2f64 (COPY_TO_REGCLASS (XFLOADf64 xaddrX4:$src), VSRC))>; -def : Pat<(store (i64 (extractelt v2i64:$A, 1)), xaddrX4:$src), +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 0)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 1)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 2)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 3)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS $S, VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 4)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 5)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 6)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 7)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), ForceXForm:$dst)>; + +def : Pat<(v2i64 (scalar_to_vector (i64 (load DSForm:$src)))), + (v2i64 (COPY_TO_REGCLASS (DFLOADf64 DSForm:$src), VSRC))>; +def : Pat<(v2i64 (scalar_to_vector (i64 (load XForm:$src)))), + (v2i64 (COPY_TO_REGCLASS (XFLOADf64 XForm:$src), VSRC))>; + +def : Pat<(v2f64 (scalar_to_vector (f64 (load DSForm:$src)))), + (v2f64 (COPY_TO_REGCLASS (DFLOADf64 DSForm:$src), VSRC))>; +def : Pat<(v2f64 (scalar_to_vector (f64 (load XForm:$src)))), + (v2f64 (COPY_TO_REGCLASS (XFLOADf64 XForm:$src), VSRC))>; +def : Pat<(store (i64 (extractelt v2i64:$A, 1)), XForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), xaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 1)), xaddrX4:$src), + sub_64), XForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 1)), XForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), xaddrX4:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 0)), xaddrX4:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 0)), xaddrX4:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xaddrX4:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 1)), iaddrX4:$src), + sub_64), XForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 0)), XForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), XForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 0)), XForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), XForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 1)), DSForm:$src), (DFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), iaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 1)), iaddrX4:$src), + sub_64), DSForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 1)), DSForm:$src), (DFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), iaddrX4:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 0)), iaddrX4:$src), - (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), iaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 0)), iaddrX4:$src), - (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), iaddrX4:$src)>; + sub_64), DSForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 0)), DSForm:$src), + (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), DSForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 0)), DSForm:$src), + (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), DSForm:$src)>; // (Un)Signed DWord vector extract -> QP def : Pat<(f128 (sint_to_fp (i64 (extractelt v2i64:$src, 0)))), @@ -4148,105 +4148,105 @@ def : Pat<(v4f32 (insertelt v4f32:$A, f32:$B, 3)), (v4f32 (XXINSERTW v4f32:$A, AlignValues.F32_TO_BE_WORD1, 0))>; -def : Pat<(v8i16 (PPCld_vec_be xoaddr:$src)), - (COPY_TO_REGCLASS (LXVH8X xoaddr:$src), VRRC)>; -def : Pat<(PPCst_vec_be v8i16:$rS, xoaddr:$dst), - (STXVH8X (COPY_TO_REGCLASS $rS, VSRC), xoaddr:$dst)>; +def : Pat<(v8i16 (PPCld_vec_be ForceXForm:$src)), + (COPY_TO_REGCLASS (LXVH8X ForceXForm:$src), VRRC)>; +def : Pat<(PPCst_vec_be v8i16:$rS, ForceXForm:$dst), + (STXVH8X (COPY_TO_REGCLASS $rS, VSRC), ForceXForm:$dst)>; -def : Pat<(v16i8 (PPCld_vec_be xoaddr:$src)), - (COPY_TO_REGCLASS (LXVB16X xoaddr:$src), VRRC)>; -def : Pat<(PPCst_vec_be v16i8:$rS, xoaddr:$dst), - (STXVB16X (COPY_TO_REGCLASS $rS, VSRC), xoaddr:$dst)>; +def : Pat<(v16i8 (PPCld_vec_be ForceXForm:$src)), + (COPY_TO_REGCLASS (LXVB16X ForceXForm:$src), VRRC)>; +def : Pat<(PPCst_vec_be v16i8:$rS, ForceXForm:$dst), + (STXVB16X (COPY_TO_REGCLASS $rS, VSRC), ForceXForm:$dst)>; // Scalar stores of i8 -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 0)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 1)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 7)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 2)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 3)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 5)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 4)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 5)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 3)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 6)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 7)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 1)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 8)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS $S, VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 9)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 15)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 10)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 11)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 13)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 12)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 13)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 11)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 14)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 15)), xoaddr:$dst), - (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 9)), VSRC), xoaddr:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 0)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 1)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 7)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 2)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 3)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 5)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 4)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 5)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 3)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 6)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 7)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 1)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 8)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS $S, VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 9)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 15)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 10)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 11)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 13)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 12)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 13)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 11)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 14)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$S, 15)), ForceXForm:$dst), + (STXSIBXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 9)), VSRC), ForceXForm:$dst)>; // Scalar stores of i16 -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 0)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 1)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 2)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 3)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 4)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS $S, VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 5)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 6)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), xoaddr:$dst)>; -def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 7)), xoaddr:$dst), - (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), xoaddr:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 0)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 8)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 1)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 6)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 2)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 4)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 3)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 2)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 4)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS $S, VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 5)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 14)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 6)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 12)), VSRC), ForceXForm:$dst)>; +def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$S, 7)), ForceXForm:$dst), + (STXSIHXv (COPY_TO_REGCLASS (v16i8 (VSLDOI $S, $S, 10)), VSRC), ForceXForm:$dst)>; defm : ScalToVecWPermute< - v2i64, (i64 (load iaddrX4:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (DFLOADf64 iaddrX4:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (DFLOADf64 iaddrX4:$src), sub_64)>; + v2i64, (i64 (load DSForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (DFLOADf64 DSForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (DFLOADf64 DSForm:$src), sub_64)>; defm : ScalToVecWPermute< - v2i64, (i64 (load xaddrX4:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (XFLOADf64 xaddrX4:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (XFLOADf64 xaddrX4:$src), sub_64)>; + v2i64, (i64 (load XForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (XFLOADf64 XForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (XFLOADf64 XForm:$src), sub_64)>; defm : ScalToVecWPermute< - v2f64, (f64 (load iaddrX4:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (DFLOADf64 iaddrX4:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (DFLOADf64 iaddrX4:$src), sub_64)>; + v2f64, (f64 (load DSForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (DFLOADf64 DSForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (DFLOADf64 DSForm:$src), sub_64)>; defm : ScalToVecWPermute< - v2f64, (f64 (load xaddrX4:$src)), - (XXPERMDIs (COPY_TO_REGCLASS (XFLOADf64 xaddrX4:$src), VSFRC), 2), - (SUBREG_TO_REG (i64 1), (XFLOADf64 xaddrX4:$src), sub_64)>; + v2f64, (f64 (load XForm:$src)), + (XXPERMDIs (COPY_TO_REGCLASS (XFLOADf64 XForm:$src), VSFRC), 2), + (SUBREG_TO_REG (i64 1), (XFLOADf64 XForm:$src), sub_64)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 0)), xaddrX4:$src), +def : Pat<(store (i64 (extractelt v2i64:$A, 0)), XForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), xaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 0)), xaddrX4:$src), + sub_64), XForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 0)), XForm:$src), (XFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), xaddrX4:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 1)), xaddrX4:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 1)), xaddrX4:$src), - (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), xaddrX4:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 0)), iaddrX4:$src), + sub_64), XForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 1)), XForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), XForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 1)), XForm:$src), + (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), XForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 0)), DSForm:$src), (DFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), - sub_64), iaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 0)), iaddrX4:$src), + sub_64), DSForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 0)), DSForm:$src), (DFSTOREf64 (EXTRACT_SUBREG (XXPERMDI $A, $A, 2), sub_64), - iaddrX4:$src)>; -def : Pat<(store (i64 (extractelt v2i64:$A, 1)), iaddrX4:$src), - (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), iaddrX4:$src)>; -def : Pat<(store (f64 (extractelt v2f64:$A, 1)), iaddrX4:$src), - (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), iaddrX4:$src)>; + DSForm:$src)>; +def : Pat<(store (i64 (extractelt v2i64:$A, 1)), DSForm:$src), + (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), DSForm:$src)>; +def : Pat<(store (f64 (extractelt v2f64:$A, 1)), DSForm:$src), + (DFSTOREf64 (EXTRACT_SUBREG $A, sub_64), DSForm:$src)>; // (Un)Signed DWord vector extract -> QP def : Pat<(f128 (sint_to_fp (i64 (extractelt v2i64:$src, 0)))), diff --git a/llvm/test/CodeGen/PowerPC/p9-dform-load-alignment.ll b/llvm/test/CodeGen/PowerPC/p9-dform-load-alignment.ll --- a/llvm/test/CodeGen/PowerPC/p9-dform-load-alignment.ll +++ b/llvm/test/CodeGen/PowerPC/p9-dform-load-alignment.ll @@ -9,7 +9,7 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: addis r3, r2, best8x8mode@toc@ha ; CHECK-NEXT: addi r3, r3, best8x8mode@toc@l -; CHECK-NEXT: ldx r3, 0, r3 +; CHECK-NEXT: ld r3, 0(r3) ; CHECK-NEXT: std r3, 0(r3) entry: %0 = load <4 x i16>, <4 x i16>* bitcast ([4 x i16]* @best8x8mode to <4 x i16>*), align 2