summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-09 09:15:31 +0000
committerChris Lattner <sabre@nondot.org>2008-03-09 09:15:31 +0000
commit86829f0ff7115a3a6dc8a95f3720d55e7f0cab12 (patch)
treecd985e83e0d633ffca06b705bec46f3dd0e96057 /llvm/lib/Target
parent271506f29c808545b33013076d03e753e401fa2d (diff)
downloadbcm5719-llvm-86829f0ff7115a3a6dc8a95f3720d55e7f0cab12.tar.gz
bcm5719-llvm-86829f0ff7115a3a6dc8a95f3720d55e7f0cab12.zip
teach X86InstrInfo::copyRegToReg how to copy into ST(0) from
an RFP register class. Teach ScheduleDAG how to handle CopyToReg with different src/dst reg classes. This allows us to compile trivial inline asms that expect stuff on the top of x87-fp stack. llvm-svn: 48107
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 01a7cd401f9..3c12fa17356 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -1465,7 +1465,7 @@ void X86InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
}
}
- // Moving ST(0) to/from a register turns into FpGET_ST0_32 etc.
+ // Moving from ST(0) turns into FpGET_ST0_32 etc.
if (SrcRC == &X86::RSTRegClass) {
// Copying from ST(0). FIXME: handle ST(1) also
assert(SrcReg == X86::ST0 && "Can only copy from TOS right now");
@@ -1481,6 +1481,23 @@ void X86InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
BuildMI(MBB, MI, get(Opc), DestReg);
return;
}
+
+ // Moving to ST(0) turns into FpSET_ST0_32 etc.
+ if (DestRC == &X86::RSTRegClass) {
+ // Copying to ST(0). FIXME: handle ST(1) also
+ assert(DestReg == X86::ST0 && "Can only copy to TOS right now");
+ unsigned Opc;
+ if (SrcRC == &X86::RFP32RegClass)
+ Opc = X86::FpSET_ST0_32;
+ else if (SrcRC == &X86::RFP64RegClass)
+ Opc = X86::FpSET_ST0_64;
+ else {
+ assert(SrcRC == &X86::RFP80RegClass);
+ Opc = X86::FpSET_ST0_80;
+ }
+ BuildMI(MBB, MI, get(Opc)).addReg(SrcReg);
+ return;
+ }
cerr << "Not yet supported!";
abort();
OpenPOWER on IntegriCloud