forked from OSchip/llvm-project
[Alignment][NFC] Use Align in SelectionDAG::getMemIntrinsicNode
Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: jholewinski, nemanjai, hiraditya, kbarton, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77149
This commit is contained in:
parent
93fc0ba145
commit
c7468c1696
|
@ -1114,14 +1114,36 @@ public:
|
||||||
/// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
|
/// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
|
||||||
/// less than FIRST_TARGET_MEMORY_OPCODE.
|
/// less than FIRST_TARGET_MEMORY_OPCODE.
|
||||||
SDValue getMemIntrinsicNode(
|
SDValue getMemIntrinsicNode(
|
||||||
unsigned Opcode, const SDLoc &dl, SDVTList VTList,
|
unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
|
||||||
ArrayRef<SDValue> Ops, EVT MemVT,
|
EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment,
|
||||||
MachinePointerInfo PtrInfo,
|
MachineMemOperand::Flags Flags = MachineMemOperand::MOLoad |
|
||||||
unsigned Align = 0,
|
MachineMemOperand::MOStore,
|
||||||
MachineMemOperand::Flags Flags
|
uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes());
|
||||||
= MachineMemOperand::MOLoad | MachineMemOperand::MOStore,
|
|
||||||
uint64_t Size = 0,
|
inline SDValue getMemIntrinsicNode(
|
||||||
const AAMDNodes &AAInfo = AAMDNodes());
|
unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
|
||||||
|
EVT MemVT, MachinePointerInfo PtrInfo, MaybeAlign Alignment = None,
|
||||||
|
MachineMemOperand::Flags Flags = MachineMemOperand::MOLoad |
|
||||||
|
MachineMemOperand::MOStore,
|
||||||
|
uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()) {
|
||||||
|
// Ensure that codegen never sees alignment 0
|
||||||
|
return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
|
||||||
|
Alignment.getValueOr(getEVTAlign(MemVT)), Flags,
|
||||||
|
Size, AAInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLVM_ATTRIBUTE_DEPRECATED(
|
||||||
|
inline SDValue getMemIntrinsicNode(
|
||||||
|
unsigned Opcode, const SDLoc &dl, SDVTList VTList,
|
||||||
|
ArrayRef<SDValue> Ops, EVT MemVT, MachinePointerInfo PtrInfo,
|
||||||
|
unsigned Alignment,
|
||||||
|
MachineMemOperand::Flags Flags = MachineMemOperand::MOLoad |
|
||||||
|
MachineMemOperand::MOStore,
|
||||||
|
uint64_t Size = 0, const AAMDNodes &AAInfo = AAMDNodes()),
|
||||||
|
"") {
|
||||||
|
return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, PtrInfo,
|
||||||
|
MaybeAlign(Alignment), Flags, Size, AAInfo);
|
||||||
|
}
|
||||||
|
|
||||||
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList,
|
SDValue getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList,
|
||||||
ArrayRef<SDValue> Ops, EVT MemVT,
|
ArrayRef<SDValue> Ops, EVT MemVT,
|
||||||
|
|
|
@ -6679,7 +6679,7 @@ SDValue SelectionDAG::getMergeValues(ArrayRef<SDValue> Ops, const SDLoc &dl) {
|
||||||
|
|
||||||
SDValue SelectionDAG::getMemIntrinsicNode(
|
SDValue SelectionDAG::getMemIntrinsicNode(
|
||||||
unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
|
unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef<SDValue> Ops,
|
||||||
EVT MemVT, MachinePointerInfo PtrInfo, unsigned Alignment,
|
EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment,
|
||||||
MachineMemOperand::Flags Flags, uint64_t Size, const AAMDNodes &AAInfo) {
|
MachineMemOperand::Flags Flags, uint64_t Size, const AAMDNodes &AAInfo) {
|
||||||
if (!Size && MemVT.isScalableVector())
|
if (!Size && MemVT.isScalableVector())
|
||||||
Size = MemoryLocation::UnknownSize;
|
Size = MemoryLocation::UnknownSize;
|
||||||
|
@ -6687,9 +6687,8 @@ SDValue SelectionDAG::getMemIntrinsicNode(
|
||||||
Size = MemVT.getStoreSize();
|
Size = MemVT.getStoreSize();
|
||||||
|
|
||||||
MachineFunction &MF = getMachineFunction();
|
MachineFunction &MF = getMachineFunction();
|
||||||
MachineMemOperand *MMO = MF.getMachineMemOperand(
|
MachineMemOperand *MMO =
|
||||||
PtrInfo, Flags, Size, Alignment ? Align(Alignment) : getEVTAlign(MemVT),
|
MF.getMachineMemOperand(PtrInfo, Flags, Size, Alignment, AAInfo);
|
||||||
AAInfo);
|
|
||||||
|
|
||||||
return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, MMO);
|
return getMemIntrinsicNode(Opcode, dl, VTList, Ops, MemVT, MMO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4713,10 +4713,10 @@ void SelectionDAGBuilder::visitTargetIntrinsic(const CallInst &I,
|
||||||
// This is target intrinsic that touches memory
|
// This is target intrinsic that touches memory
|
||||||
AAMDNodes AAInfo;
|
AAMDNodes AAInfo;
|
||||||
I.getAAMetadata(AAInfo);
|
I.getAAMetadata(AAInfo);
|
||||||
Result = DAG.getMemIntrinsicNode(
|
Result =
|
||||||
Info.opc, getCurSDLoc(), VTs, Ops, Info.memVT,
|
DAG.getMemIntrinsicNode(Info.opc, getCurSDLoc(), VTs, Ops, Info.memVT,
|
||||||
MachinePointerInfo(Info.ptrVal, Info.offset),
|
MachinePointerInfo(Info.ptrVal, Info.offset),
|
||||||
Info.align ? Info.align->value() : 0, Info.flags, Info.size, AAInfo);
|
Info.align, Info.flags, Info.size, AAInfo);
|
||||||
} else if (!HasChain) {
|
} else if (!HasChain) {
|
||||||
Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, getCurSDLoc(), VTs, Ops);
|
Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, getCurSDLoc(), VTs, Ops);
|
||||||
} else if (!I.getType()->isVoidTy()) {
|
} else if (!I.getType()->isVoidTy()) {
|
||||||
|
@ -6529,12 +6529,10 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
|
||||||
Ops[2] = getValue(I.getArgOperand(1));
|
Ops[2] = getValue(I.getArgOperand(1));
|
||||||
Ops[3] = getValue(I.getArgOperand(2));
|
Ops[3] = getValue(I.getArgOperand(2));
|
||||||
Ops[4] = getValue(I.getArgOperand(3));
|
Ops[4] = getValue(I.getArgOperand(3));
|
||||||
SDValue Result = DAG.getMemIntrinsicNode(ISD::PREFETCH, sdl,
|
SDValue Result = DAG.getMemIntrinsicNode(
|
||||||
DAG.getVTList(MVT::Other), Ops,
|
ISD::PREFETCH, sdl, DAG.getVTList(MVT::Other), Ops,
|
||||||
EVT::getIntegerVT(*Context, 8),
|
EVT::getIntegerVT(*Context, 8), MachinePointerInfo(I.getArgOperand(0)),
|
||||||
MachinePointerInfo(I.getArgOperand(0)),
|
/* align */ None, Flags);
|
||||||
0, /* align */
|
|
||||||
Flags);
|
|
||||||
|
|
||||||
// Chain the prefetch in parallell with any pending loads, to stay out of
|
// Chain the prefetch in parallell with any pending loads, to stay out of
|
||||||
// the way of later optimizations.
|
// the way of later optimizations.
|
||||||
|
|
|
@ -218,11 +218,10 @@ static void ComputePTXValueVTs(const TargetLowering &TLI, const DataLayout &DL,
|
||||||
// covered by the vector op. Otherwise, it returns 1.
|
// covered by the vector op. Otherwise, it returns 1.
|
||||||
static unsigned CanMergeParamLoadStoresStartingAt(
|
static unsigned CanMergeParamLoadStoresStartingAt(
|
||||||
unsigned Idx, uint32_t AccessSize, const SmallVectorImpl<EVT> &ValueVTs,
|
unsigned Idx, uint32_t AccessSize, const SmallVectorImpl<EVT> &ValueVTs,
|
||||||
const SmallVectorImpl<uint64_t> &Offsets, unsigned ParamAlignment) {
|
const SmallVectorImpl<uint64_t> &Offsets, Align ParamAlignment) {
|
||||||
assert(isPowerOf2_32(AccessSize) && "must be a power of 2!");
|
|
||||||
|
|
||||||
// Can't vectorize if param alignment is not sufficient.
|
// Can't vectorize if param alignment is not sufficient.
|
||||||
if (AccessSize > ParamAlignment)
|
if (ParamAlignment < AccessSize)
|
||||||
return 1;
|
return 1;
|
||||||
// Can't vectorize if offset is not aligned.
|
// Can't vectorize if offset is not aligned.
|
||||||
if (Offsets[Idx] & (AccessSize - 1))
|
if (Offsets[Idx] & (AccessSize - 1))
|
||||||
|
@ -282,7 +281,7 @@ enum ParamVectorizationFlags {
|
||||||
static SmallVector<ParamVectorizationFlags, 16>
|
static SmallVector<ParamVectorizationFlags, 16>
|
||||||
VectorizePTXValueVTs(const SmallVectorImpl<EVT> &ValueVTs,
|
VectorizePTXValueVTs(const SmallVectorImpl<EVT> &ValueVTs,
|
||||||
const SmallVectorImpl<uint64_t> &Offsets,
|
const SmallVectorImpl<uint64_t> &Offsets,
|
||||||
unsigned ParamAlignment) {
|
Align ParamAlignment) {
|
||||||
// Set vector size to match ValueVTs and mark all elements as
|
// Set vector size to match ValueVTs and mark all elements as
|
||||||
// scalars by default.
|
// scalars by default.
|
||||||
SmallVector<ParamVectorizationFlags, 16> VectorInfo;
|
SmallVector<ParamVectorizationFlags, 16> VectorInfo;
|
||||||
|
@ -1243,7 +1242,7 @@ NVPTXTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
|
||||||
|
|
||||||
std::string NVPTXTargetLowering::getPrototype(
|
std::string NVPTXTargetLowering::getPrototype(
|
||||||
const DataLayout &DL, Type *retTy, const ArgListTy &Args,
|
const DataLayout &DL, Type *retTy, const ArgListTy &Args,
|
||||||
const SmallVectorImpl<ISD::OutputArg> &Outs, unsigned retAlignment,
|
const SmallVectorImpl<ISD::OutputArg> &Outs, MaybeAlign retAlignment,
|
||||||
ImmutableCallSite CS) const {
|
ImmutableCallSite CS) const {
|
||||||
auto PtrVT = getPointerTy(DL);
|
auto PtrVT = getPointerTy(DL);
|
||||||
|
|
||||||
|
@ -1279,8 +1278,8 @@ std::string NVPTXTargetLowering::getPrototype(
|
||||||
O << ".param .b" << PtrVT.getSizeInBits() << " _";
|
O << ".param .b" << PtrVT.getSizeInBits() << " _";
|
||||||
} else if (retTy->isAggregateType() || retTy->isVectorTy() ||
|
} else if (retTy->isAggregateType() || retTy->isVectorTy() ||
|
||||||
retTy->isIntegerTy(128)) {
|
retTy->isIntegerTy(128)) {
|
||||||
O << ".param .align " << retAlignment << " .b8 _["
|
O << ".param .align " << (retAlignment ? retAlignment->value() : 0)
|
||||||
<< DL.getTypeAllocSize(retTy) << "]";
|
<< " .b8 _[" << DL.getTypeAllocSize(retTy) << "]";
|
||||||
} else {
|
} else {
|
||||||
llvm_unreachable("Unknown return type");
|
llvm_unreachable("Unknown return type");
|
||||||
}
|
}
|
||||||
|
@ -1353,16 +1352,16 @@ std::string NVPTXTargetLowering::getPrototype(
|
||||||
return O.str();
|
return O.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
|
Align NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
|
||||||
ImmutableCallSite CS,
|
ImmutableCallSite CS, Type *Ty,
|
||||||
Type *Ty, unsigned Idx,
|
unsigned Idx,
|
||||||
const DataLayout &DL) const {
|
const DataLayout &DL) const {
|
||||||
if (!CS) {
|
if (!CS) {
|
||||||
// CallSite is zero, fallback to ABI type alignment
|
// CallSite is zero, fallback to ABI type alignment
|
||||||
return DL.getABITypeAlignment(Ty);
|
return DL.getABITypeAlign(Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Align = 0;
|
unsigned Alignment = 0;
|
||||||
const Value *DirectCallee = CS.getCalledFunction();
|
const Value *DirectCallee = CS.getCalledFunction();
|
||||||
|
|
||||||
if (!DirectCallee) {
|
if (!DirectCallee) {
|
||||||
|
@ -1374,8 +1373,8 @@ unsigned NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
|
||||||
// With bitcast'd call targets, the instruction will be the call
|
// With bitcast'd call targets, the instruction will be the call
|
||||||
if (isa<CallInst>(CalleeI)) {
|
if (isa<CallInst>(CalleeI)) {
|
||||||
// Check if we have call alignment metadata
|
// Check if we have call alignment metadata
|
||||||
if (getAlign(*cast<CallInst>(CalleeI), Idx, Align))
|
if (getAlign(*cast<CallInst>(CalleeI), Idx, Alignment))
|
||||||
return Align;
|
return Align(Alignment);
|
||||||
|
|
||||||
const Value *CalleeV = cast<CallInst>(CalleeI)->getCalledValue();
|
const Value *CalleeV = cast<CallInst>(CalleeI)->getCalledValue();
|
||||||
// Ignore any bitcast instructions
|
// Ignore any bitcast instructions
|
||||||
|
@ -1397,12 +1396,12 @@ unsigned NVPTXTargetLowering::getArgumentAlignment(SDValue Callee,
|
||||||
// Check for function alignment information if we found that the
|
// Check for function alignment information if we found that the
|
||||||
// ultimate target is a Function
|
// ultimate target is a Function
|
||||||
if (DirectCallee)
|
if (DirectCallee)
|
||||||
if (getAlign(*cast<Function>(DirectCallee), Idx, Align))
|
if (getAlign(*cast<Function>(DirectCallee), Idx, Alignment))
|
||||||
return Align;
|
return Align(Alignment);
|
||||||
|
|
||||||
// Call is indirect or alignment information is not available, fall back to
|
// Call is indirect or alignment information is not available, fall back to
|
||||||
// the ABI type alignment
|
// the ABI type alignment
|
||||||
return DL.getABITypeAlignment(Ty);
|
return DL.getABITypeAlign(Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
|
@ -1450,15 +1449,14 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
SmallVector<EVT, 16> VTs;
|
SmallVector<EVT, 16> VTs;
|
||||||
SmallVector<uint64_t, 16> Offsets;
|
SmallVector<uint64_t, 16> Offsets;
|
||||||
ComputePTXValueVTs(*this, DL, Ty, VTs, &Offsets);
|
ComputePTXValueVTs(*this, DL, Ty, VTs, &Offsets);
|
||||||
unsigned ArgAlign =
|
Align ArgAlign = getArgumentAlignment(Callee, CS, Ty, paramCount + 1, DL);
|
||||||
getArgumentAlignment(Callee, CS, Ty, paramCount + 1, DL);
|
|
||||||
unsigned AllocSize = DL.getTypeAllocSize(Ty);
|
unsigned AllocSize = DL.getTypeAllocSize(Ty);
|
||||||
SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue);
|
SDVTList DeclareParamVTs = DAG.getVTList(MVT::Other, MVT::Glue);
|
||||||
bool NeedAlign; // Does argument declaration specify alignment?
|
bool NeedAlign; // Does argument declaration specify alignment?
|
||||||
if (Ty->isAggregateType() || Ty->isVectorTy() || Ty->isIntegerTy(128)) {
|
if (Ty->isAggregateType() || Ty->isVectorTy() || Ty->isIntegerTy(128)) {
|
||||||
// declare .param .align <align> .b8 .param<n>[<size>];
|
// declare .param .align <align> .b8 .param<n>[<size>];
|
||||||
SDValue DeclareParamOps[] = {
|
SDValue DeclareParamOps[] = {
|
||||||
Chain, DAG.getConstant(ArgAlign, dl, MVT::i32),
|
Chain, DAG.getConstant(ArgAlign.value(), dl, MVT::i32),
|
||||||
DAG.getConstant(paramCount, dl, MVT::i32),
|
DAG.getConstant(paramCount, dl, MVT::i32),
|
||||||
DAG.getConstant(AllocSize, dl, MVT::i32), InFlag};
|
DAG.getConstant(AllocSize, dl, MVT::i32), InFlag};
|
||||||
Chain = DAG.getNode(NVPTXISD::DeclareParam, dl, DeclareParamVTs,
|
Chain = DAG.getNode(NVPTXISD::DeclareParam, dl, DeclareParamVTs,
|
||||||
|
@ -1539,8 +1537,9 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
// Adjust type of the store op if we've extended the scalar
|
// Adjust type of the store op if we've extended the scalar
|
||||||
// return value.
|
// return value.
|
||||||
EVT TheStoreType = ExtendIntegerParam ? MVT::i32 : VTs[j];
|
EVT TheStoreType = ExtendIntegerParam ? MVT::i32 : VTs[j];
|
||||||
unsigned EltAlign =
|
MaybeAlign EltAlign;
|
||||||
NeedAlign ? GreatestCommonDivisor64(ArgAlign, Offsets[j]) : 0;
|
if (NeedAlign)
|
||||||
|
EltAlign = commonAlignment(ArgAlign, Offsets[j]);
|
||||||
|
|
||||||
Chain = DAG.getMemIntrinsicNode(
|
Chain = DAG.getMemIntrinsicNode(
|
||||||
Op, dl, DAG.getVTList(MVT::Other, MVT::Glue), StoreOperands,
|
Op, dl, DAG.getVTList(MVT::Other, MVT::Glue), StoreOperands,
|
||||||
|
@ -1604,10 +1603,9 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
DAG.getConstant(paramCount, dl, MVT::i32),
|
DAG.getConstant(paramCount, dl, MVT::i32),
|
||||||
DAG.getConstant(curOffset, dl, MVT::i32),
|
DAG.getConstant(curOffset, dl, MVT::i32),
|
||||||
theVal, InFlag };
|
theVal, InFlag };
|
||||||
Chain = DAG.getMemIntrinsicNode(NVPTXISD::StoreParam, dl, CopyParamVTs,
|
Chain = DAG.getMemIntrinsicNode(
|
||||||
CopyParamOps, elemtype,
|
NVPTXISD::StoreParam, dl, CopyParamVTs, CopyParamOps, elemtype,
|
||||||
MachinePointerInfo(), /* Align */ 0,
|
MachinePointerInfo(), /* Align */ None, MachineMemOperand::MOStore);
|
||||||
MachineMemOperand::MOStore);
|
|
||||||
|
|
||||||
InFlag = Chain.getValue(1);
|
InFlag = Chain.getValue(1);
|
||||||
}
|
}
|
||||||
|
@ -1615,7 +1613,7 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalAddressSDNode *Func = dyn_cast<GlobalAddressSDNode>(Callee.getNode());
|
GlobalAddressSDNode *Func = dyn_cast<GlobalAddressSDNode>(Callee.getNode());
|
||||||
unsigned retAlignment = 0;
|
MaybeAlign retAlignment = None;
|
||||||
|
|
||||||
// Handle Result
|
// Handle Result
|
||||||
if (Ins.size() > 0) {
|
if (Ins.size() > 0) {
|
||||||
|
@ -1644,11 +1642,12 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
InFlag = Chain.getValue(1);
|
InFlag = Chain.getValue(1);
|
||||||
} else {
|
} else {
|
||||||
retAlignment = getArgumentAlignment(Callee, CS, RetTy, 0, DL);
|
retAlignment = getArgumentAlignment(Callee, CS, RetTy, 0, DL);
|
||||||
|
assert(retAlignment && "retAlignment is guaranteed to be set");
|
||||||
SDVTList DeclareRetVTs = DAG.getVTList(MVT::Other, MVT::Glue);
|
SDVTList DeclareRetVTs = DAG.getVTList(MVT::Other, MVT::Glue);
|
||||||
SDValue DeclareRetOps[] = { Chain,
|
SDValue DeclareRetOps[] = {
|
||||||
DAG.getConstant(retAlignment, dl, MVT::i32),
|
Chain, DAG.getConstant(retAlignment->value(), dl, MVT::i32),
|
||||||
DAG.getConstant(resultsz / 8, dl, MVT::i32),
|
DAG.getConstant(resultsz / 8, dl, MVT::i32),
|
||||||
DAG.getConstant(0, dl, MVT::i32), InFlag };
|
DAG.getConstant(0, dl, MVT::i32), InFlag};
|
||||||
Chain = DAG.getNode(NVPTXISD::DeclareRetParam, dl, DeclareRetVTs,
|
Chain = DAG.getNode(NVPTXISD::DeclareRetParam, dl, DeclareRetVTs,
|
||||||
DeclareRetOps);
|
DeclareRetOps);
|
||||||
InFlag = Chain.getValue(1);
|
InFlag = Chain.getValue(1);
|
||||||
|
@ -1754,7 +1753,7 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
ComputePTXValueVTs(*this, DL, RetTy, VTs, &Offsets, 0);
|
ComputePTXValueVTs(*this, DL, RetTy, VTs, &Offsets, 0);
|
||||||
assert(VTs.size() == Ins.size() && "Bad value decomposition");
|
assert(VTs.size() == Ins.size() && "Bad value decomposition");
|
||||||
|
|
||||||
unsigned RetAlign = getArgumentAlignment(Callee, CS, RetTy, 0, DL);
|
Align RetAlign = getArgumentAlignment(Callee, CS, RetTy, 0, DL);
|
||||||
auto VectorInfo = VectorizePTXValueVTs(VTs, Offsets, RetAlign);
|
auto VectorInfo = VectorizePTXValueVTs(VTs, Offsets, RetAlign);
|
||||||
|
|
||||||
SmallVector<EVT, 6> LoadVTs;
|
SmallVector<EVT, 6> LoadVTs;
|
||||||
|
@ -1770,7 +1769,7 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||||
bool needTruncate = false;
|
bool needTruncate = false;
|
||||||
EVT TheLoadType = VTs[i];
|
EVT TheLoadType = VTs[i];
|
||||||
EVT EltType = Ins[i].VT;
|
EVT EltType = Ins[i].VT;
|
||||||
unsigned EltAlign = GreatestCommonDivisor64(RetAlign, Offsets[i]);
|
Align EltAlign = commonAlignment(RetAlign, Offsets[i]);
|
||||||
if (ExtendIntegerRetVal) {
|
if (ExtendIntegerRetVal) {
|
||||||
TheLoadType = MVT::i32;
|
TheLoadType = MVT::i32;
|
||||||
EltType = MVT::i32;
|
EltType = MVT::i32;
|
||||||
|
@ -2545,7 +2544,7 @@ SDValue NVPTXTargetLowering::LowerFormalArguments(
|
||||||
ComputePTXValueVTs(*this, DL, Ty, VTs, &Offsets, 0);
|
ComputePTXValueVTs(*this, DL, Ty, VTs, &Offsets, 0);
|
||||||
assert(VTs.size() > 0 && "Unexpected empty type.");
|
assert(VTs.size() > 0 && "Unexpected empty type.");
|
||||||
auto VectorInfo =
|
auto VectorInfo =
|
||||||
VectorizePTXValueVTs(VTs, Offsets, DL.getABITypeAlignment(Ty));
|
VectorizePTXValueVTs(VTs, Offsets, DL.getABITypeAlign(Ty));
|
||||||
|
|
||||||
SDValue Arg = getParamSymbol(DAG, idx, PtrVT);
|
SDValue Arg = getParamSymbol(DAG, idx, PtrVT);
|
||||||
int VecIdx = -1; // Index of the first element of the current vector.
|
int VecIdx = -1; // Index of the first element of the current vector.
|
||||||
|
@ -2664,7 +2663,7 @@ NVPTXTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
|
||||||
assert(VTs.size() == OutVals.size() && "Bad return value decomposition");
|
assert(VTs.size() == OutVals.size() && "Bad return value decomposition");
|
||||||
|
|
||||||
auto VectorInfo = VectorizePTXValueVTs(
|
auto VectorInfo = VectorizePTXValueVTs(
|
||||||
VTs, Offsets, RetTy->isSized() ? DL.getABITypeAlignment(RetTy) : 1);
|
VTs, Offsets, RetTy->isSized() ? DL.getABITypeAlign(RetTy) : Align(1));
|
||||||
|
|
||||||
// PTX Interoperability Guide 3.3(A): [Integer] Values shorter than
|
// PTX Interoperability Guide 3.3(A): [Integer] Values shorter than
|
||||||
// 32-bits are sign extended or zero extended, depending on whether
|
// 32-bits are sign extended or zero extended, depending on whether
|
||||||
|
@ -2716,10 +2715,9 @@ NVPTXTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
|
||||||
// Adjust type of load/store op if we've extended the scalar
|
// Adjust type of load/store op if we've extended the scalar
|
||||||
// return value.
|
// return value.
|
||||||
EVT TheStoreType = ExtendIntegerRetVal ? MVT::i32 : VTs[i];
|
EVT TheStoreType = ExtendIntegerRetVal ? MVT::i32 : VTs[i];
|
||||||
Chain = DAG.getMemIntrinsicNode(Op, dl, DAG.getVTList(MVT::Other),
|
Chain = DAG.getMemIntrinsicNode(
|
||||||
StoreOperands, TheStoreType,
|
Op, dl, DAG.getVTList(MVT::Other), StoreOperands, TheStoreType,
|
||||||
MachinePointerInfo(), /* Align */ 1,
|
MachinePointerInfo(), Align(1), MachineMemOperand::MOStore);
|
||||||
MachineMemOperand::MOStore);
|
|
||||||
// Cleanup vector state.
|
// Cleanup vector state.
|
||||||
StoreOperands.clear();
|
StoreOperands.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,8 +491,7 @@ public:
|
||||||
|
|
||||||
std::string getPrototype(const DataLayout &DL, Type *, const ArgListTy &,
|
std::string getPrototype(const DataLayout &DL, Type *, const ArgListTy &,
|
||||||
const SmallVectorImpl<ISD::OutputArg> &,
|
const SmallVectorImpl<ISD::OutputArg> &,
|
||||||
unsigned retAlignment,
|
MaybeAlign retAlignment, ImmutableCallSite CS) const;
|
||||||
ImmutableCallSite CS) const;
|
|
||||||
|
|
||||||
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
|
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
|
||||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
|
@ -579,8 +578,8 @@ private:
|
||||||
SelectionDAG &DAG) const override;
|
SelectionDAG &DAG) const override;
|
||||||
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
|
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
|
||||||
|
|
||||||
unsigned getArgumentAlignment(SDValue Callee, ImmutableCallSite CS, Type *Ty,
|
Align getArgumentAlignment(SDValue Callee, ImmutableCallSite CS, Type *Ty,
|
||||||
unsigned Idx, const DataLayout &DL) const;
|
unsigned Idx, const DataLayout &DL) const;
|
||||||
};
|
};
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
|
||||||
|
|
|
@ -2750,7 +2750,7 @@ SDValue PPCTargetLowering::getTOCEntry(SelectionDAG &DAG, const SDLoc &dl,
|
||||||
SDValue Ops[] = { GA, Reg };
|
SDValue Ops[] = { GA, Reg };
|
||||||
return DAG.getMemIntrinsicNode(
|
return DAG.getMemIntrinsicNode(
|
||||||
PPCISD::TOC_ENTRY, dl, DAG.getVTList(VT, MVT::Other), Ops, VT,
|
PPCISD::TOC_ENTRY, dl, DAG.getVTList(VT, MVT::Other), Ops, VT,
|
||||||
MachinePointerInfo::getGOT(DAG.getMachineFunction()), 0,
|
MachinePointerInfo::getGOT(DAG.getMachineFunction()), None,
|
||||||
MachineMemOperand::MOLoad);
|
MachineMemOperand::MOLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1185,7 +1185,7 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
|
||||||
SDVTList VTs = CurDAG->getVTList(MVT::Other);
|
SDVTList VTs = CurDAG->getVTList(MVT::Other);
|
||||||
SDValue Ops[] = {N->getOperand(0), N->getOperand(1), MemTmp};
|
SDValue Ops[] = {N->getOperand(0), N->getOperand(1), MemTmp};
|
||||||
Store = CurDAG->getMemIntrinsicNode(X86ISD::FST, dl, VTs, Ops, MemVT,
|
Store = CurDAG->getMemIntrinsicNode(X86ISD::FST, dl, VTs, Ops, MemVT,
|
||||||
MPI, /*Align*/ 0,
|
MPI, /*Align*/ None,
|
||||||
MachineMemOperand::MOStore);
|
MachineMemOperand::MOStore);
|
||||||
if (N->getFlags().hasNoFPExcept()) {
|
if (N->getFlags().hasNoFPExcept()) {
|
||||||
SDNodeFlags Flags = Store->getFlags();
|
SDNodeFlags Flags = Store->getFlags();
|
||||||
|
@ -1201,9 +1201,9 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
|
||||||
if (!DstIsSSE) {
|
if (!DstIsSSE) {
|
||||||
SDVTList VTs = CurDAG->getVTList(DstVT, MVT::Other);
|
SDVTList VTs = CurDAG->getVTList(DstVT, MVT::Other);
|
||||||
SDValue Ops[] = {Store, MemTmp};
|
SDValue Ops[] = {Store, MemTmp};
|
||||||
Result =
|
Result = CurDAG->getMemIntrinsicNode(
|
||||||
CurDAG->getMemIntrinsicNode(X86ISD::FLD, dl, VTs, Ops, MemVT, MPI,
|
X86ISD::FLD, dl, VTs, Ops, MemVT, MPI,
|
||||||
/*Align*/ 0, MachineMemOperand::MOLoad);
|
/*Align*/ None, MachineMemOperand::MOLoad);
|
||||||
if (N->getFlags().hasNoFPExcept()) {
|
if (N->getFlags().hasNoFPExcept()) {
|
||||||
SDNodeFlags Flags = Result->getFlags();
|
SDNodeFlags Flags = Result->getFlags();
|
||||||
Flags.setNoFPExcept(true);
|
Flags.setNoFPExcept(true);
|
||||||
|
|
|
@ -8419,11 +8419,9 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
|
||||||
if (TLI.isTypeLegal(VecVT)) {
|
if (TLI.isTypeLegal(VecVT)) {
|
||||||
SDVTList Tys = DAG.getVTList(VecVT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(VecVT, MVT::Other);
|
||||||
SDValue Ops[] = { LDBase->getChain(), LDBase->getBasePtr() };
|
SDValue Ops[] = { LDBase->getChain(), LDBase->getBasePtr() };
|
||||||
SDValue ResNode =
|
SDValue ResNode = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VZEXT_LOAD, DL, Tys, Ops, VecSVT,
|
X86ISD::VZEXT_LOAD, DL, Tys, Ops, VecSVT, LDBase->getPointerInfo(),
|
||||||
LDBase->getPointerInfo(),
|
LDBase->getAlign(), MachineMemOperand::MOLoad);
|
||||||
LDBase->getAlignment(),
|
|
||||||
MachineMemOperand::MOLoad);
|
|
||||||
for (auto *LD : Loads)
|
for (auto *LD : Loads)
|
||||||
if (LD)
|
if (LD)
|
||||||
DAG.makeEquivalentMemoryOrdering(LD, ResNode);
|
DAG.makeEquivalentMemoryOrdering(LD, ResNode);
|
||||||
|
@ -8665,7 +8663,7 @@ static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp,
|
||||||
SDValue CP = DAG.getConstantPool(C, PVT);
|
SDValue CP = DAG.getConstantPool(C, PVT);
|
||||||
unsigned Repeat = VT.getSizeInBits() / SplatBitSize;
|
unsigned Repeat = VT.getSizeInBits() / SplatBitSize;
|
||||||
|
|
||||||
unsigned Alignment = cast<ConstantPoolSDNode>(CP)->getAlignment();
|
MaybeAlign Alignment(cast<ConstantPoolSDNode>(CP)->getAlignment());
|
||||||
SDVTList Tys =
|
SDVTList Tys =
|
||||||
DAG.getVTList(MVT::getVectorVT(CVT, Repeat), MVT::Other);
|
DAG.getVTList(MVT::getVectorVT(CVT, Repeat), MVT::Other);
|
||||||
SDValue Ops[] = {DAG.getEntryNode(), CP};
|
SDValue Ops[] = {DAG.getEntryNode(), CP};
|
||||||
|
@ -8753,7 +8751,7 @@ static SDValue lowerBuildVectorAsBroadcast(BuildVectorSDNode *BVOp,
|
||||||
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
|
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
|
||||||
SDValue CP =
|
SDValue CP =
|
||||||
DAG.getConstantPool(C, TLI.getPointerTy(DAG.getDataLayout()));
|
DAG.getConstantPool(C, TLI.getPointerTy(DAG.getDataLayout()));
|
||||||
unsigned Alignment = cast<ConstantPoolSDNode>(CP)->getAlignment();
|
MaybeAlign Alignment(cast<ConstantPoolSDNode>(CP)->getAlignment());
|
||||||
|
|
||||||
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
||||||
SDValue Ops[] = {DAG.getEntryNode(), CP};
|
SDValue Ops[] = {DAG.getEntryNode(), CP};
|
||||||
|
@ -19248,15 +19246,16 @@ SDValue X86TargetLowering::LowerSINT_TO_FP(SDValue Op,
|
||||||
ValueToStore = DAG.getBitcast(MVT::f64, ValueToStore);
|
ValueToStore = DAG.getBitcast(MVT::f64, ValueToStore);
|
||||||
|
|
||||||
unsigned Size = SrcVT.getStoreSize();
|
unsigned Size = SrcVT.getStoreSize();
|
||||||
|
Align Alignment(Size);
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
auto PtrVT = getPointerTy(MF.getDataLayout());
|
auto PtrVT = getPointerTy(MF.getDataLayout());
|
||||||
int SSFI = MF.getFrameInfo().CreateStackObject(Size, Size, false);
|
int SSFI = MF.getFrameInfo().CreateStackObject(Size, Alignment, false);
|
||||||
MachinePointerInfo MPI =
|
MachinePointerInfo MPI =
|
||||||
MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SSFI);
|
MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SSFI);
|
||||||
SDValue StackSlot = DAG.getFrameIndex(SSFI, PtrVT);
|
SDValue StackSlot = DAG.getFrameIndex(SSFI, PtrVT);
|
||||||
Chain = DAG.getStore(Chain, dl, ValueToStore, StackSlot, MPI, Size);
|
Chain = DAG.getStore(Chain, dl, ValueToStore, StackSlot, MPI, Alignment);
|
||||||
std::pair<SDValue, SDValue> Tmp =
|
std::pair<SDValue, SDValue> Tmp =
|
||||||
BuildFILD(VT, SrcVT, dl, Chain, StackSlot, MPI, Size, DAG);
|
BuildFILD(VT, SrcVT, dl, Chain, StackSlot, MPI, Alignment, DAG);
|
||||||
|
|
||||||
if (IsStrict)
|
if (IsStrict)
|
||||||
return DAG.getMergeValues({Tmp.first, Tmp.second}, dl);
|
return DAG.getMergeValues({Tmp.first, Tmp.second}, dl);
|
||||||
|
@ -19266,7 +19265,7 @@ SDValue X86TargetLowering::LowerSINT_TO_FP(SDValue Op,
|
||||||
|
|
||||||
std::pair<SDValue, SDValue> X86TargetLowering::BuildFILD(
|
std::pair<SDValue, SDValue> X86TargetLowering::BuildFILD(
|
||||||
EVT DstVT, EVT SrcVT, const SDLoc &DL, SDValue Chain, SDValue Pointer,
|
EVT DstVT, EVT SrcVT, const SDLoc &DL, SDValue Chain, SDValue Pointer,
|
||||||
MachinePointerInfo PtrInfo, unsigned Alignment, SelectionDAG &DAG) const {
|
MachinePointerInfo PtrInfo, Align Alignment, SelectionDAG &DAG) const {
|
||||||
// Build the FILD
|
// Build the FILD
|
||||||
SDVTList Tys;
|
SDVTList Tys;
|
||||||
bool useSSE = isScalarFPTypeInSSEReg(DstVT);
|
bool useSSE = isScalarFPTypeInSSEReg(DstVT);
|
||||||
|
@ -19559,8 +19558,8 @@ static SDValue lowerUINT_TO_FP_vXi32(SDValue Op, SelectionDAG &DAG,
|
||||||
SDValue Ops[] = {DAG.getEntryNode(), CPIdx};
|
SDValue Ops[] = {DAG.getEntryNode(), CPIdx};
|
||||||
SDValue VBias = DAG.getMemIntrinsicNode(
|
SDValue VBias = DAG.getMemIntrinsicNode(
|
||||||
X86ISD::VBROADCAST_LOAD, DL, Tys, Ops, MVT::f64,
|
X86ISD::VBROADCAST_LOAD, DL, Tys, Ops, MVT::f64,
|
||||||
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()),
|
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), Align(8),
|
||||||
/*Alignment*/ 8, MachineMemOperand::MOLoad);
|
MachineMemOperand::MOLoad);
|
||||||
|
|
||||||
SDValue Or = DAG.getNode(ISD::OR, DL, MVT::v4i64, ZExtIn,
|
SDValue Or = DAG.getNode(ISD::OR, DL, MVT::v4i64, ZExtIn,
|
||||||
DAG.getBitcast(MVT::v4i64, VBias));
|
DAG.getBitcast(MVT::v4i64, VBias));
|
||||||
|
@ -19739,7 +19738,7 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
|
||||||
SDValue Store2 = DAG.getStore(Store1, dl, DAG.getConstant(0, dl, MVT::i32),
|
SDValue Store2 = DAG.getStore(Store1, dl, DAG.getConstant(0, dl, MVT::i32),
|
||||||
OffsetSlot, MPI.getWithOffset(4), 4);
|
OffsetSlot, MPI.getWithOffset(4), 4);
|
||||||
std::pair<SDValue, SDValue> Tmp =
|
std::pair<SDValue, SDValue> Tmp =
|
||||||
BuildFILD(DstVT, MVT::i64, dl, Store2, StackSlot, MPI, 8, DAG);
|
BuildFILD(DstVT, MVT::i64, dl, Store2, StackSlot, MPI, Align(8), DAG);
|
||||||
if (IsStrict)
|
if (IsStrict)
|
||||||
return DAG.getMergeValues({Tmp.first, Tmp.second}, dl);
|
return DAG.getMergeValues({Tmp.first, Tmp.second}, dl);
|
||||||
|
|
||||||
|
@ -19755,7 +19754,7 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
|
||||||
ValueToStore = DAG.getBitcast(MVT::f64, ValueToStore);
|
ValueToStore = DAG.getBitcast(MVT::f64, ValueToStore);
|
||||||
}
|
}
|
||||||
SDValue Store =
|
SDValue Store =
|
||||||
DAG.getStore(Chain, dl, ValueToStore, StackSlot, MPI, 8 /*Align*/);
|
DAG.getStore(Chain, dl, ValueToStore, StackSlot, MPI, Align(8));
|
||||||
// For i64 source, we need to add the appropriate power of 2 if the input
|
// For i64 source, we need to add the appropriate power of 2 if the input
|
||||||
// was negative. This is the same as the optimization in
|
// was negative. This is the same as the optimization in
|
||||||
// DAGTypeLegalizer::ExpandIntOp_UNIT_TO_FP, and for it to be safe here,
|
// DAGTypeLegalizer::ExpandIntOp_UNIT_TO_FP, and for it to be safe here,
|
||||||
|
@ -19763,9 +19762,9 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
|
||||||
// in SSE. (The generic code can't know it's OK to do this, or how to.)
|
// in SSE. (The generic code can't know it's OK to do this, or how to.)
|
||||||
SDVTList Tys = DAG.getVTList(MVT::f80, MVT::Other);
|
SDVTList Tys = DAG.getVTList(MVT::f80, MVT::Other);
|
||||||
SDValue Ops[] = { Store, StackSlot };
|
SDValue Ops[] = { Store, StackSlot };
|
||||||
SDValue Fild = DAG.getMemIntrinsicNode(X86ISD::FILD, dl, Tys, Ops,
|
SDValue Fild =
|
||||||
MVT::i64, MPI, 8 /*Align*/,
|
DAG.getMemIntrinsicNode(X86ISD::FILD, dl, Tys, Ops, MVT::i64, MPI,
|
||||||
MachineMemOperand::MOLoad);
|
Align(8), MachineMemOperand::MOLoad);
|
||||||
Chain = Fild.getValue(1);
|
Chain = Fild.getValue(1);
|
||||||
|
|
||||||
|
|
||||||
|
@ -20716,14 +20715,13 @@ SDValue X86TargetLowering::LRINT_LLRINTHelper(SDNode *N,
|
||||||
SDValue Ops[] = { Chain, StackPtr };
|
SDValue Ops[] = { Chain, StackPtr };
|
||||||
|
|
||||||
Src = DAG.getMemIntrinsicNode(X86ISD::FLD, DL, Tys, Ops, SrcVT, MPI,
|
Src = DAG.getMemIntrinsicNode(X86ISD::FLD, DL, Tys, Ops, SrcVT, MPI,
|
||||||
/*Align*/0, MachineMemOperand::MOLoad);
|
/*Align*/ None, MachineMemOperand::MOLoad);
|
||||||
Chain = Src.getValue(1);
|
Chain = Src.getValue(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue StoreOps[] = { Chain, Src, StackPtr };
|
SDValue StoreOps[] = { Chain, Src, StackPtr };
|
||||||
Chain = DAG.getMemIntrinsicNode(X86ISD::FIST, DL,
|
Chain = DAG.getMemIntrinsicNode(X86ISD::FIST, DL, DAG.getVTList(MVT::Other),
|
||||||
DAG.getVTList(MVT::Other), StoreOps,
|
StoreOps, DstVT, MPI, /*Align*/ None,
|
||||||
DstVT, MPI, /*Align*/0,
|
|
||||||
MachineMemOperand::MOStore);
|
MachineMemOperand::MOStore);
|
||||||
|
|
||||||
return DAG.getLoad(DstVT, DL, Chain, StackPtr, MPI);
|
return DAG.getLoad(DstVT, DL, Chain, StackPtr, MPI);
|
||||||
|
@ -23623,11 +23621,8 @@ SDValue X86TargetLowering::LowerVAARG(SDValue Op, SelectionDAG &DAG) const {
|
||||||
DAG.getConstant(Align, dl, MVT::i32)};
|
DAG.getConstant(Align, dl, MVT::i32)};
|
||||||
SDVTList VTs = DAG.getVTList(getPointerTy(DAG.getDataLayout()), MVT::Other);
|
SDVTList VTs = DAG.getVTList(getPointerTy(DAG.getDataLayout()), MVT::Other);
|
||||||
SDValue VAARG = DAG.getMemIntrinsicNode(
|
SDValue VAARG = DAG.getMemIntrinsicNode(
|
||||||
X86ISD::VAARG_64, dl,
|
X86ISD::VAARG_64, dl, VTs, InstOps, MVT::i64, MachinePointerInfo(SV),
|
||||||
VTs, InstOps, MVT::i64,
|
/*Align=*/None, MachineMemOperand::MOLoad | MachineMemOperand::MOStore);
|
||||||
MachinePointerInfo(SV),
|
|
||||||
/*Align=*/0,
|
|
||||||
MachineMemOperand::MOLoad | MachineMemOperand::MOStore);
|
|
||||||
Chain = VAARG.getValue(1);
|
Chain = VAARG.getValue(1);
|
||||||
|
|
||||||
// Load the next argument and return it
|
// Load the next argument and return it
|
||||||
|
@ -25809,10 +25804,10 @@ SDValue X86TargetLowering::LowerFLT_ROUNDS_(SDValue Op,
|
||||||
SDValue Ops[] = {Chain, StackSlot};
|
SDValue Ops[] = {Chain, StackSlot};
|
||||||
Chain = DAG.getMemIntrinsicNode(X86ISD::FNSTCW16m, DL,
|
Chain = DAG.getMemIntrinsicNode(X86ISD::FNSTCW16m, DL,
|
||||||
DAG.getVTList(MVT::Other), Ops, MVT::i16, MPI,
|
DAG.getVTList(MVT::Other), Ops, MVT::i16, MPI,
|
||||||
2 /*Align*/, MachineMemOperand::MOStore);
|
Align(2), MachineMemOperand::MOStore);
|
||||||
|
|
||||||
// Load FP Control Word from stack slot
|
// Load FP Control Word from stack slot
|
||||||
SDValue CWD = DAG.getLoad(MVT::i16, DL, Chain, StackSlot, MPI, 2 /*Align*/);
|
SDValue CWD = DAG.getLoad(MVT::i16, DL, Chain, StackSlot, MPI, Align(2));
|
||||||
Chain = CWD.getValue(1);
|
Chain = CWD.getValue(1);
|
||||||
|
|
||||||
// Mask and turn the control bits into a shift for the lookup table.
|
// Mask and turn the control bits into a shift for the lookup table.
|
||||||
|
@ -28487,7 +28482,7 @@ static SDValue LowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG,
|
||||||
SDValue LdOps[] = {Chain, StackPtr};
|
SDValue LdOps[] = {Chain, StackPtr};
|
||||||
SDValue Value =
|
SDValue Value =
|
||||||
DAG.getMemIntrinsicNode(X86ISD::FILD, dl, Tys, LdOps, MVT::i64, MPI,
|
DAG.getMemIntrinsicNode(X86ISD::FILD, dl, Tys, LdOps, MVT::i64, MPI,
|
||||||
/*Align*/ 0, MachineMemOperand::MOLoad);
|
/*Align*/ None, MachineMemOperand::MOLoad);
|
||||||
Chain = Value.getValue(1);
|
Chain = Value.getValue(1);
|
||||||
|
|
||||||
// Now use an FIST to do the atomic store.
|
// Now use an FIST to do the atomic store.
|
||||||
|
@ -29898,10 +29893,9 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
|
||||||
MachinePointerInfo MPI =
|
MachinePointerInfo MPI =
|
||||||
MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI);
|
MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI);
|
||||||
SDValue StoreOps[] = { Chain, Result, StackPtr };
|
SDValue StoreOps[] = { Chain, Result, StackPtr };
|
||||||
Chain = DAG.getMemIntrinsicNode(X86ISD::FIST, dl,
|
Chain = DAG.getMemIntrinsicNode(
|
||||||
DAG.getVTList(MVT::Other), StoreOps,
|
X86ISD::FIST, dl, DAG.getVTList(MVT::Other), StoreOps, MVT::i64,
|
||||||
MVT::i64, MPI, 0 /*Align*/,
|
MPI, None /*Align*/, MachineMemOperand::MOStore);
|
||||||
MachineMemOperand::MOStore);
|
|
||||||
|
|
||||||
// Finally load the value back from the stack temporary and return it.
|
// Finally load the value back from the stack temporary and return it.
|
||||||
// This load is not atomic and doesn't need to be.
|
// This load is not atomic and doesn't need to be.
|
||||||
|
@ -35321,11 +35315,9 @@ static SDValue combineTargetShuffle(SDValue N, SelectionDAG &DAG,
|
||||||
if (LN->isSimple()) {
|
if (LN->isSimple()) {
|
||||||
SDVTList Tys = DAG.getVTList(MVT::v2f64, MVT::Other);
|
SDVTList Tys = DAG.getVTList(MVT::v2f64, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue VZLoad =
|
SDValue VZLoad = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VZEXT_LOAD, DL, Tys, Ops, MVT::f64,
|
X86ISD::VZEXT_LOAD, DL, Tys, Ops, MVT::f64, LN->getPointerInfo(),
|
||||||
LN->getPointerInfo(),
|
LN->getAlign(), LN->getMemOperand()->getFlags());
|
||||||
LN->getAlignment(),
|
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
SDValue Movddup = DAG.getNode(X86ISD::MOVDDUP, DL, MVT::v2f64, VZLoad);
|
SDValue Movddup = DAG.getNode(X86ISD::MOVDDUP, DL, MVT::v2f64, VZLoad);
|
||||||
DCI.CombineTo(N.getNode(), Movddup);
|
DCI.CombineTo(N.getNode(), Movddup);
|
||||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), VZLoad.getValue(1));
|
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), VZLoad.getValue(1));
|
||||||
|
@ -35423,11 +35415,10 @@ static SDValue combineTargetShuffle(SDValue N, SelectionDAG &DAG,
|
||||||
if (LN->isSimple()) {
|
if (LN->isSimple()) {
|
||||||
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue BcastLd =
|
SDValue BcastLd = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, DL, Tys, Ops,
|
X86ISD::VBROADCAST_LOAD, DL, Tys, Ops, MVT::i16,
|
||||||
MVT::i16, LN->getPointerInfo(),
|
LN->getPointerInfo(), LN->getAlign(),
|
||||||
LN->getAlignment(),
|
LN->getMemOperand()->getFlags());
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
DCI.CombineTo(N.getNode(), BcastLd);
|
DCI.CombineTo(N.getNode(), BcastLd);
|
||||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BcastLd.getValue(1));
|
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BcastLd.getValue(1));
|
||||||
DCI.recursivelyDeleteUnusedNodes(LN);
|
DCI.recursivelyDeleteUnusedNodes(LN);
|
||||||
|
@ -35468,12 +35459,11 @@ static SDValue combineTargetShuffle(SDValue N, SelectionDAG &DAG,
|
||||||
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
||||||
SDValue Ptr = DAG.getMemBasePlusOffset(LN->getBasePtr(), Offset, DL);
|
SDValue Ptr = DAG.getMemBasePlusOffset(LN->getBasePtr(), Offset, DL);
|
||||||
SDValue Ops[] = { LN->getChain(), Ptr };
|
SDValue Ops[] = { LN->getChain(), Ptr };
|
||||||
SDValue BcastLd =
|
SDValue BcastLd = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, DL, Tys, Ops,
|
X86ISD::VBROADCAST_LOAD, DL, Tys, Ops, MVT::i16,
|
||||||
MVT::i16,
|
LN->getPointerInfo().getWithOffset(Offset),
|
||||||
LN->getPointerInfo().getWithOffset(Offset),
|
commonAlignment(LN->getAlign(), Offset),
|
||||||
MinAlign(LN->getAlignment(), Offset),
|
LN->getMemOperand()->getFlags());
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
DCI.CombineTo(N.getNode(), BcastLd);
|
DCI.CombineTo(N.getNode(), BcastLd);
|
||||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BcastLd.getValue(1));
|
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BcastLd.getValue(1));
|
||||||
DCI.recursivelyDeleteUnusedNodes(LN);
|
DCI.recursivelyDeleteUnusedNodes(LN);
|
||||||
|
@ -35506,11 +35496,10 @@ static SDValue combineTargetShuffle(SDValue N, SelectionDAG &DAG,
|
||||||
if (LN->isSimple()) {
|
if (LN->isSimple()) {
|
||||||
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue BcastLd =
|
SDValue BcastLd = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, DL, Tys, Ops,
|
X86ISD::VBROADCAST_LOAD, DL, Tys, Ops, MVT::f64,
|
||||||
MVT::f64, LN->getPointerInfo(),
|
LN->getPointerInfo(), LN->getAlign(),
|
||||||
LN->getAlignment(),
|
LN->getMemOperand()->getFlags());
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
DCI.CombineTo(N.getNode(), BcastLd);
|
DCI.CombineTo(N.getNode(), BcastLd);
|
||||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BcastLd.getValue(1));
|
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), BcastLd.getValue(1));
|
||||||
DCI.recursivelyDeleteUnusedNodes(LN);
|
DCI.recursivelyDeleteUnusedNodes(LN);
|
||||||
|
@ -36271,12 +36260,10 @@ static SDValue combineShuffle(SDNode *N, SelectionDAG &DAG,
|
||||||
if (LN->isSimple()) {
|
if (LN->isSimple()) {
|
||||||
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue VZLoad =
|
SDValue VZLoad = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VZEXT_LOAD, dl, Tys, Ops,
|
X86ISD::VZEXT_LOAD, dl, Tys, Ops, VT.getVectorElementType(),
|
||||||
VT.getVectorElementType(),
|
LN->getPointerInfo(), LN->getAlign(),
|
||||||
LN->getPointerInfo(),
|
LN->getMemOperand()->getFlags());
|
||||||
LN->getAlignment(),
|
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
DCI.CombineTo(N, VZLoad);
|
DCI.CombineTo(N, VZLoad);
|
||||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), VZLoad.getValue(1));
|
DAG.ReplaceAllUsesOfValueWith(SDValue(LN, 1), VZLoad.getValue(1));
|
||||||
DCI.recursivelyDeleteUnusedNodes(LN);
|
DCI.recursivelyDeleteUnusedNodes(LN);
|
||||||
|
@ -44207,11 +44194,9 @@ static SDValue combineX86INT_TO_FP(SDNode *N, SelectionDAG &DAG,
|
||||||
MVT LoadVT = MVT::getVectorVT(MemVT, 128 / NumBits);
|
MVT LoadVT = MVT::getVectorVT(MemVT, 128 / NumBits);
|
||||||
SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue VZLoad =
|
SDValue VZLoad = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VZEXT_LOAD, dl, Tys, Ops, MemVT,
|
X86ISD::VZEXT_LOAD, dl, Tys, Ops, MemVT, LN->getPointerInfo(),
|
||||||
LN->getPointerInfo(),
|
LN->getAlign(), LN->getMemOperand()->getFlags());
|
||||||
LN->getAlignment(),
|
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
SDValue Convert = DAG.getNode(N->getOpcode(), dl, VT,
|
SDValue Convert = DAG.getNode(N->getOpcode(), dl, VT,
|
||||||
DAG.getBitcast(InVT, VZLoad));
|
DAG.getBitcast(InVT, VZLoad));
|
||||||
DCI.CombineTo(N, Convert);
|
DCI.CombineTo(N, Convert);
|
||||||
|
@ -44243,11 +44228,9 @@ static SDValue combineCVTP2I_CVTTP2I(SDNode *N, SelectionDAG &DAG,
|
||||||
MVT LoadVT = MVT::getVectorVT(MemVT, 128 / NumBits);
|
MVT LoadVT = MVT::getVectorVT(MemVT, 128 / NumBits);
|
||||||
SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue VZLoad =
|
SDValue VZLoad = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VZEXT_LOAD, dl, Tys, Ops, MemVT,
|
X86ISD::VZEXT_LOAD, dl, Tys, Ops, MemVT, LN->getPointerInfo(),
|
||||||
LN->getPointerInfo(),
|
LN->getAlign(), LN->getMemOperand()->getFlags());
|
||||||
LN->getAlignment(),
|
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
SDValue Convert = DAG.getNode(N->getOpcode(), dl, VT,
|
SDValue Convert = DAG.getNode(N->getOpcode(), dl, VT,
|
||||||
DAG.getBitcast(InVT, VZLoad));
|
DAG.getBitcast(InVT, VZLoad));
|
||||||
DCI.CombineTo(N, Convert);
|
DCI.CombineTo(N, Convert);
|
||||||
|
@ -44332,11 +44315,9 @@ static SDValue combineCVTPH2PS(SDNode *N, SelectionDAG &DAG,
|
||||||
SDLoc dl(N);
|
SDLoc dl(N);
|
||||||
SDVTList Tys = DAG.getVTList(MVT::v2i64, MVT::Other);
|
SDVTList Tys = DAG.getVTList(MVT::v2i64, MVT::Other);
|
||||||
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
SDValue Ops[] = { LN->getChain(), LN->getBasePtr() };
|
||||||
SDValue VZLoad =
|
SDValue VZLoad = DAG.getMemIntrinsicNode(
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VZEXT_LOAD, dl, Tys, Ops, MVT::i64,
|
X86ISD::VZEXT_LOAD, dl, Tys, Ops, MVT::i64, LN->getPointerInfo(),
|
||||||
LN->getPointerInfo(),
|
LN->getAlign(), LN->getMemOperand()->getFlags());
|
||||||
LN->getAlignment(),
|
|
||||||
LN->getMemOperand()->getFlags());
|
|
||||||
SDValue Convert = DAG.getNode(N->getOpcode(), dl, MVT::v4f32,
|
SDValue Convert = DAG.getNode(N->getOpcode(), dl, MVT::v4f32,
|
||||||
DAG.getBitcast(MVT::v8i16, VZLoad));
|
DAG.getBitcast(MVT::v8i16, VZLoad));
|
||||||
DCI.CombineTo(N, Convert);
|
DCI.CombineTo(N, Convert);
|
||||||
|
@ -45580,7 +45561,7 @@ static SDValue combineSIntToFP(SDNode *N, SelectionDAG &DAG,
|
||||||
std::pair<SDValue, SDValue> Tmp =
|
std::pair<SDValue, SDValue> Tmp =
|
||||||
Subtarget.getTargetLowering()->BuildFILD(
|
Subtarget.getTargetLowering()->BuildFILD(
|
||||||
VT, InVT, SDLoc(N), Ld->getChain(), Ld->getBasePtr(),
|
VT, InVT, SDLoc(N), Ld->getChain(), Ld->getBasePtr(),
|
||||||
Ld->getPointerInfo(), Ld->getAlignment(), DAG);
|
Ld->getPointerInfo(), Ld->getAlign(), DAG);
|
||||||
DAG.ReplaceAllUsesOfValueWith(Op0.getValue(1), Tmp.second);
|
DAG.ReplaceAllUsesOfValueWith(Op0.getValue(1), Tmp.second);
|
||||||
return Tmp.first;
|
return Tmp.first;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ namespace llvm {
|
||||||
std::pair<SDValue, SDValue> BuildFILD(EVT DstVT, EVT SrcVT, const SDLoc &DL,
|
std::pair<SDValue, SDValue> BuildFILD(EVT DstVT, EVT SrcVT, const SDLoc &DL,
|
||||||
SDValue Chain, SDValue Pointer,
|
SDValue Chain, SDValue Pointer,
|
||||||
MachinePointerInfo PtrInfo,
|
MachinePointerInfo PtrInfo,
|
||||||
unsigned Align,
|
Align Alignment,
|
||||||
SelectionDAG &DAG) const;
|
SelectionDAG &DAG) const;
|
||||||
|
|
||||||
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override;
|
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override;
|
||||||
|
|
Loading…
Reference in New Issue