mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-10 18:34:09 +00:00
give FP_TO_INT16_IN_MEM and friends a memoperand. They are only
used with stack slots, but hey, lets be safe. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
40d66052f4
commit
0729093cd7
@ -1169,12 +1169,10 @@ bool X86DAGToDAGISel::SelectAddr(SDNode *Parent, SDValue N, SDValue &Base,
|
|||||||
Parent->getOpcode() != ISD::PREFETCH &&
|
Parent->getOpcode() != ISD::PREFETCH &&
|
||||||
Parent->getOpcode() != ISD::INTRINSIC_W_CHAIN && // unaligned loads, fixme
|
Parent->getOpcode() != ISD::INTRINSIC_W_CHAIN && // unaligned loads, fixme
|
||||||
Parent->getOpcode() != ISD::INTRINSIC_VOID && // nontemporal stores.
|
Parent->getOpcode() != ISD::INTRINSIC_VOID && // nontemporal stores.
|
||||||
|
Parent->getOpcode() != X86ISD::FNSTCW16m &&
|
||||||
Parent->getOpcode() != X86ISD::FLD &&
|
Parent->getOpcode() != X86ISD::FLD &&
|
||||||
Parent->getOpcode() != X86ISD::FILD &&
|
Parent->getOpcode() != X86ISD::FILD &&
|
||||||
Parent->getOpcode() != X86ISD::FILD_FLAG &&
|
Parent->getOpcode() != X86ISD::FILD_FLAG &&
|
||||||
Parent->getOpcode() != X86ISD::FP_TO_INT16_IN_MEM &&
|
|
||||||
Parent->getOpcode() != X86ISD::FP_TO_INT32_IN_MEM &&
|
|
||||||
Parent->getOpcode() != X86ISD::FP_TO_INT64_IN_MEM &&
|
|
||||||
Parent->getOpcode() != X86ISD::FST) {
|
Parent->getOpcode() != X86ISD::FST) {
|
||||||
unsigned AddrSpace =
|
unsigned AddrSpace =
|
||||||
cast<MemSDNode>(Parent)->getPointerInfo().getAddrSpace();
|
cast<MemSDNode>(Parent)->getPointerInfo().getAddrSpace();
|
||||||
|
@ -6599,7 +6599,7 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
|
|||||||
|
|
||||||
std::pair<SDValue,SDValue> X86TargetLowering::
|
std::pair<SDValue,SDValue> X86TargetLowering::
|
||||||
FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned) const {
|
FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned) const {
|
||||||
DebugLoc dl = Op.getDebugLoc();
|
DebugLoc DL = Op.getDebugLoc();
|
||||||
|
|
||||||
EVT DstTy = Op.getValueType();
|
EVT DstTy = Op.getValueType();
|
||||||
|
|
||||||
@ -6628,6 +6628,8 @@ FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned) const {
|
|||||||
int SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize, false);
|
int SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize, false);
|
||||||
SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
|
SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned Opc;
|
unsigned Opc;
|
||||||
switch (DstTy.getSimpleVT().SimpleTy) {
|
switch (DstTy.getSimpleVT().SimpleTy) {
|
||||||
default: llvm_unreachable("Invalid FP_TO_SINT to lower!");
|
default: llvm_unreachable("Invalid FP_TO_SINT to lower!");
|
||||||
@ -6640,22 +6642,27 @@ FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned) const {
|
|||||||
SDValue Value = Op.getOperand(0);
|
SDValue Value = Op.getOperand(0);
|
||||||
if (isScalarFPTypeInSSEReg(Op.getOperand(0).getValueType())) {
|
if (isScalarFPTypeInSSEReg(Op.getOperand(0).getValueType())) {
|
||||||
assert(DstTy == MVT::i64 && "Invalid FP_TO_SINT to lower!");
|
assert(DstTy == MVT::i64 && "Invalid FP_TO_SINT to lower!");
|
||||||
Chain = DAG.getStore(Chain, dl, Value, StackSlot,
|
Chain = DAG.getStore(Chain, DL, Value, StackSlot,
|
||||||
MachinePointerInfo::getFixedStack(SSFI),
|
MachinePointerInfo::getFixedStack(SSFI),
|
||||||
false, false, 0);
|
false, false, 0);
|
||||||
SDVTList Tys = DAG.getVTList(Op.getOperand(0).getValueType(), MVT::Other);
|
SDVTList Tys = DAG.getVTList(Op.getOperand(0).getValueType(), MVT::Other);
|
||||||
SDValue Ops[] = {
|
SDValue Ops[] = {
|
||||||
Chain, StackSlot, DAG.getValueType(Op.getOperand(0).getValueType())
|
Chain, StackSlot, DAG.getValueType(Op.getOperand(0).getValueType())
|
||||||
};
|
};
|
||||||
Value = DAG.getNode(X86ISD::FLD, dl, Tys, Ops, 3);
|
Value = DAG.getNode(X86ISD::FLD, DL, Tys, Ops, 3);
|
||||||
Chain = Value.getValue(1);
|
Chain = Value.getValue(1);
|
||||||
SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize, false);
|
SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize, false);
|
||||||
StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
|
StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MachineMemOperand *MMO =
|
||||||
|
MF.getMachineMemOperand(MachinePointerInfo::getFixedStack(SSFI),
|
||||||
|
MachineMemOperand::MOStore, MemSize, MemSize);
|
||||||
|
|
||||||
// Build the FP_TO_INT*_IN_MEM
|
// Build the FP_TO_INT*_IN_MEM
|
||||||
SDValue Ops[] = { Chain, Value, StackSlot };
|
SDValue Ops[] = { Chain, Value, StackSlot };
|
||||||
SDValue FIST = DAG.getNode(Opc, dl, MVT::Other, Ops, 3);
|
SDValue FIST = DAG.getMemIntrinsicNode(Opc, DL, DAG.getVTList(MVT::Other),
|
||||||
|
Ops, 3, DstTy, MMO);
|
||||||
|
|
||||||
return std::make_pair(FIST, StackSlot);
|
return std::make_pair(FIST, StackSlot);
|
||||||
}
|
}
|
||||||
|
@ -65,15 +65,6 @@ namespace llvm {
|
|||||||
FILD,
|
FILD,
|
||||||
FILD_FLAG,
|
FILD_FLAG,
|
||||||
|
|
||||||
/// FP_TO_INT*_IN_MEM - This instruction implements FP_TO_SINT with the
|
|
||||||
/// integer destination in memory and a FP reg source. This corresponds
|
|
||||||
/// to the X86::FIST*m instructions and the rounding mode change stuff. It
|
|
||||||
/// has two inputs (token chain and address) and two outputs (int value
|
|
||||||
/// and token chain).
|
|
||||||
FP_TO_INT16_IN_MEM,
|
|
||||||
FP_TO_INT32_IN_MEM,
|
|
||||||
FP_TO_INT64_IN_MEM,
|
|
||||||
|
|
||||||
/// FLD - This instruction implements an extending load to FP stack slots.
|
/// FLD - This instruction implements an extending load to FP stack slots.
|
||||||
/// This corresponds to the X86::FLD32m / X86::FLD64m. It takes a chain
|
/// This corresponds to the X86::FLD32m / X86::FLD64m. It takes a chain
|
||||||
/// operand, ptr to load from, and a ValueType node indicating the type
|
/// operand, ptr to load from, and a ValueType node indicating the type
|
||||||
@ -309,7 +300,17 @@ namespace llvm {
|
|||||||
LCMPXCHG8_DAG,
|
LCMPXCHG8_DAG,
|
||||||
|
|
||||||
// VZEXT_LOAD - Load, scalar_to_vector, and zero extend.
|
// VZEXT_LOAD - Load, scalar_to_vector, and zero extend.
|
||||||
VZEXT_LOAD
|
VZEXT_LOAD,
|
||||||
|
|
||||||
|
|
||||||
|
/// FP_TO_INT*_IN_MEM - This instruction implements FP_TO_SINT with the
|
||||||
|
/// integer destination in memory and a FP reg source. This corresponds
|
||||||
|
/// to the X86::FIST*m instructions and the rounding mode change stuff. It
|
||||||
|
/// has two inputs (token chain and address) and two outputs (int value
|
||||||
|
/// and token chain).
|
||||||
|
FP_TO_INT16_IN_MEM,
|
||||||
|
FP_TO_INT32_IN_MEM,
|
||||||
|
FP_TO_INT64_IN_MEM
|
||||||
|
|
||||||
// WARNING: Do not add anything in the end unless you want the node to
|
// WARNING: Do not add anything in the end unless you want the node to
|
||||||
// have memop! In fact, starting from ATOMADD64_DAG all opcodes will be
|
// have memop! In fact, starting from ATOMADD64_DAG all opcodes will be
|
||||||
|
@ -40,13 +40,14 @@ def X86fild : SDNode<"X86ISD::FILD", SDTX86Fild,
|
|||||||
def X86fildflag : SDNode<"X86ISD::FILD_FLAG", SDTX86Fild,
|
def X86fildflag : SDNode<"X86ISD::FILD_FLAG", SDTX86Fild,
|
||||||
[SDNPHasChain, SDNPOutFlag, SDNPMayLoad]>;
|
[SDNPHasChain, SDNPOutFlag, SDNPMayLoad]>;
|
||||||
def X86fp_to_i16mem : SDNode<"X86ISD::FP_TO_INT16_IN_MEM", SDTX86FpToIMem,
|
def X86fp_to_i16mem : SDNode<"X86ISD::FP_TO_INT16_IN_MEM", SDTX86FpToIMem,
|
||||||
[SDNPHasChain, SDNPMayStore]>;
|
[SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
|
||||||
def X86fp_to_i32mem : SDNode<"X86ISD::FP_TO_INT32_IN_MEM", SDTX86FpToIMem,
|
def X86fp_to_i32mem : SDNode<"X86ISD::FP_TO_INT32_IN_MEM", SDTX86FpToIMem,
|
||||||
[SDNPHasChain, SDNPMayStore]>;
|
[SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
|
||||||
def X86fp_to_i64mem : SDNode<"X86ISD::FP_TO_INT64_IN_MEM", SDTX86FpToIMem,
|
def X86fp_to_i64mem : SDNode<"X86ISD::FP_TO_INT64_IN_MEM", SDTX86FpToIMem,
|
||||||
[SDNPHasChain, SDNPMayStore]>;
|
[SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
|
||||||
def X86fp_cwd_get16 : SDNode<"X86ISD::FNSTCW16m", SDTX86CwdStore,
|
def X86fp_cwd_get16 : SDNode<"X86ISD::FNSTCW16m", SDTX86CwdStore,
|
||||||
[SDNPHasChain, SDNPMayStore, SDNPSideEffect]>;
|
[SDNPHasChain, SDNPMayStore, SDNPSideEffect,
|
||||||
|
SDNPMemOperand]>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// FPStack pattern fragments
|
// FPStack pattern fragments
|
||||||
|
Loading…
x
Reference in New Issue
Block a user