From e3de85b447b0a94c82f147159a0c903ea47e0069 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Sat, 4 Feb 2006 02:20:30 +0000 Subject: [PATCH] Separate FILD and FILD_FLAG, the later is only used for SSE2. It produces a flag so it can be flagged to a FST. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25953 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 8 +++++--- lib/Target/X86/X86ISelLowering.h | 10 ++++++---- lib/Target/X86/X86InstrInfo.td | 5 ++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 1015f5e7af6..def4f570170 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -1476,18 +1476,19 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { std::vector Tys; Tys.push_back(MVT::f64); Tys.push_back(MVT::Other); - Tys.push_back(MVT::Flag); + if (X86ScalarSSE) Tys.push_back(MVT::Flag); std::vector Ops; Ops.push_back(Chain); Ops.push_back(StackSlot); Ops.push_back(DAG.getValueType(SrcVT)); - Result = DAG.getNode(X86ISD::FILD, Tys, Ops); + Result = DAG.getNode(X86ScalarSSE ? X86ISD::FILD_FLAG :X86ISD::FILD, + Tys, Ops); if (X86ScalarSSE) { Chain = Result.getValue(1); SDOperand InFlag = Result.getValue(2); - // FIXME: Currently the FST is flagged to the FILD. This + // FIXME: Currently the FST is flagged to the FILD_FLAG. This // shouldn't be necessary except that RFP cannot be live across // multiple blocks. When stackifier is fixed, they can be uncoupled. MachineFunction &MF = DAG.getMachineFunction(); @@ -1974,6 +1975,7 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const { case X86ISD::FAND: return "X86ISD::FAND"; case X86ISD::FXOR: return "X86ISD::FXOR"; case X86ISD::FILD: return "X86ISD::FILD"; + case X86ISD::FILD_FLAG: return "X86ISD::FILD_FLAG"; case X86ISD::FP_TO_INT16_IN_MEM: return "X86ISD::FP_TO_INT16_IN_MEM"; case X86ISD::FP_TO_INT32_IN_MEM: return "X86ISD::FP_TO_INT32_IN_MEM"; case X86ISD::FP_TO_INT64_IN_MEM: return "X86ISD::FP_TO_INT64_IN_MEM"; diff --git a/lib/Target/X86/X86ISelLowering.h b/lib/Target/X86/X86ISelLowering.h index bccd10b3d97..88d8e6ca3fb 100644 --- a/lib/Target/X86/X86ISelLowering.h +++ b/lib/Target/X86/X86ISelLowering.h @@ -49,11 +49,13 @@ namespace llvm { /// to X86::XORPS or X86::XORPD. FXOR, - /// FILD - This instruction implements SINT_TO_FP with the integer source - /// in memory and FP reg result. This corresponds to the X86::FILD*m - /// instructions. It has three inputs (token chain, address, and source - /// type) and three outputs (FP value, token chain, and a flag). + /// FILD, FILD_FLAG - This instruction implements SINT_TO_FP with the + /// integer source in memory and FP reg result. This corresponds to the + /// X86::FILD*m instructions. It has three inputs (token chain, address, + /// and source type) and two outputs (FP value and token chain). FILD_FLAG + /// also produces a flag). FILD, + 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 diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index 7e228d30238..3e8cc09f4bf 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -108,6 +108,8 @@ def X86fld : SDNode<"X86ISD::FLD", SDTX86Fld, def X86fst : SDNode<"X86ISD::FST", SDTX86Fst, [SDNPHasChain, SDNPInFlag]>; def X86fild : SDNode<"X86ISD::FILD", SDTX86Fild, + [SDNPHasChain]>; +def X86fildflag: SDNode<"X86ISD::FILD_FLAG",SDTX86Fild, [SDNPHasChain, SDNPOutFlag]>; def X86fp_to_i16mem : SDNode<"X86ISD::FP_TO_INT16_IN_MEM", SDTX86FpToIMem, [SDNPHasChain]>; @@ -3121,7 +3123,8 @@ def : Pat<(f64 fp64immneg0), (FpCHS (FpLD0))>, Requires<[FPStack]>; def : Pat<(f64 fp64immneg1), (FpCHS (FpLD1))>, Requires<[FPStack]>; // Used to conv. i64 to f64 since there isn't a SSE version. -def : Pat<(X86fild addr:$src, i64), (FpILD64m addr:$src)>, Requires<[HasSSE2]>; +def : Pat<(X86fildflag addr:$src, i64), (FpILD64m addr:$src)>, + Requires<[HasSSE2]>; //===----------------------------------------------------------------------===// // Some peepholes