llvm.org GIT mirror llvm / 84be958
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 Stuart Hastings 8 years ago
2 changed file(s) with 32 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
66996699 DebugLoc dl = Op.getDebugLoc();
67006700 unsigned Size = SrcVT.getSizeInBits()/8;
67016701 MachineFunction &MF = DAG.getMachineFunction();
6702
6703 SDValue Addr = Op.getOperand(0);
6704 if (Addr.getOpcode() == ISD::LOAD)
6705 return BuildFILD(Op, SrcVT, DAG.getEntryNode(), Addr, DAG);
6706
67026707 int SSFI = MF.getFrameInfo()->CreateStackObject(Size, Size, false);
67036708 SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
67046709 SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl, Op.getOperand(0),
67226727
67236728 unsigned ByteSize = SrcVT.getSizeInBits()/8;
67246729
6725 int SSFI = cast(StackSlot)->getIndex();
6726 MachineMemOperand *MMO =
6727 DAG.getMachineFunction()
6728 .getMachineMemOperand(MachinePointerInfo::getFixedStack(SSFI),
6729 MachineMemOperand::MOLoad, ByteSize, ByteSize);
6730
6730 FrameIndexSDNode *FI = dyn_cast(StackSlot);
6731 MachineMemOperand *MMO;
6732 if (FI) {
6733 int SSFI = FI->getIndex();
6734 MMO =
6735 DAG.getMachineFunction()
6736 .getMachineMemOperand(MachinePointerInfo::getFixedStack(SSFI),
6737 MachineMemOperand::MOLoad, ByteSize, ByteSize);
6738 } else {
6739 MMO = cast(StackSlot)->getMemOperand();
6740 StackSlot = StackSlot.getOperand(1);
6741 }
67316742 SDValue Ops[] = { Chain, StackSlot, DAG.getValueType(SrcVT) };
67326743 SDValue Result = DAG.getMemIntrinsicNode(useSSE ? X86ISD::FILD_FLAG :
67336744 X86ISD::FILD, DL,
0 ; RUN: llc %s -march=x86
1 ; ModuleID = ''
2 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"
3 target triple = "i386-apple-macosx10.6.6"
4
5 define float @f(i64* nocapture %x) nounwind readonly ssp {
6 entry:
7 ; CHECK: movl
8 ; CHECK-NOT: movl
9 %tmp1 = load i64* %x, align 4
10 ; CHECK: fildll
11 %conv = sitofp i64 %tmp1 to float
12 %add = fadd float %conv, 1.000000e+00
13 ret float %add
14 }