mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-04 19:38:22 +00:00
Omit unnecessary stack copy when x87 input is a load.
rdar://problem/6373334 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
19e1f633af
commit
84be958ed8
@ -6700,6 +6700,11 @@ SDValue X86TargetLowering::LowerSINT_TO_FP(SDValue Op,
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
unsigned Size = SrcVT.getSizeInBits()/8;
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
|
||||
SDValue Addr = Op.getOperand(0);
|
||||
if (Addr.getOpcode() == ISD::LOAD)
|
||||
return BuildFILD(Op, SrcVT, DAG.getEntryNode(), Addr, DAG);
|
||||
|
||||
int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size, false);
|
||||
SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
|
||||
SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl, Op.getOperand(0),
|
||||
@ -6723,12 +6728,18 @@ SDValue X86TargetLowering::BuildFILD(SDValue Op, EVT SrcVT, SDValue Chain,
|
||||
|
||||
unsigned ByteSize = SrcVT.getSizeInBits()/8;
|
||||
|
||||
int SSFI = cast<FrameIndexSDNode>(StackSlot)->getIndex();
|
||||
MachineMemOperand *MMO =
|
||||
DAG.getMachineFunction()
|
||||
.getMachineMemOperand(MachinePointerInfo::getFixedStack(SSFI),
|
||||
MachineMemOperand::MOLoad, ByteSize, ByteSize);
|
||||
|
||||
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(StackSlot);
|
||||
MachineMemOperand *MMO;
|
||||
if (FI) {
|
||||
int SSFI = FI->getIndex();
|
||||
MMO =
|
||||
DAG.getMachineFunction()
|
||||
.getMachineMemOperand(MachinePointerInfo::getFixedStack(SSFI),
|
||||
MachineMemOperand::MOLoad, ByteSize, ByteSize);
|
||||
} else {
|
||||
MMO = cast<LoadSDNode>(StackSlot)->getMemOperand();
|
||||
StackSlot = StackSlot.getOperand(1);
|
||||
}
|
||||
SDValue Ops[] = { Chain, StackSlot, DAG.getValueType(SrcVT) };
|
||||
SDValue Result = DAG.getMemIntrinsicNode(useSSE ? X86ISD::FILD_FLAG :
|
||||
X86ISD::FILD, DL,
|
||||
|
15
test/CodeGen/X86/2011-06-01-fildll.ll
Normal file
15
test/CodeGen/X86/2011-06-01-fildll.ll
Normal file
@ -0,0 +1,15 @@
|
||||
; RUN: llc %s -march=x86
|
||||
; ModuleID = '<stdin>'
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
|
||||
target triple = "i386-apple-macosx10.6.6"
|
||||
|
||||
define float @f(i64* nocapture %x) nounwind readonly ssp {
|
||||
entry:
|
||||
; CHECK: movl
|
||||
; CHECK-NOT: movl
|
||||
%tmp1 = load i64* %x, align 4
|
||||
; CHECK: fildll
|
||||
%conv = sitofp i64 %tmp1 to float
|
||||
%add = fadd float %conv, 1.000000e+00
|
||||
ret float %add
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user