Index: src/IceTargetLoweringX8632.cpp |
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
index 27f9ae00064e6fc8f57fcce995becebd6c91eee1..24c22ff23a857800f1ac8622cebb29cd58e5afa3 100644 |
--- a/src/IceTargetLoweringX8632.cpp |
+++ b/src/IceTargetLoweringX8632.cpp |
@@ -497,6 +497,18 @@ void TargetX8632::addProlog(CfgNode *Node) { |
uint32_t GlobalsAndSubsequentPaddingSize = |
GlobalsSize + LocalsSlotsPaddingBytes; |
+ // Functions returning scalar floating point types may need to convert values |
+ // from an in-register xmm value to the top of the x87 floating point stack. |
+ // This is done by a movp[sd] and an fld[sd]. Ensure there is enough scratch |
+ // space on the stack for this. |
+ Type ReturnType = Func->getReturnType(); |
Jim Stichnoth
2015/11/16 23:54:09
const
|
+ if (isScalarFloatingType(ReturnType)) { |
+ // Avoid misaligned double-precicion load/store. |
+ NeedsStackAlignment = true; |
+ SpillAreaSizeBytes = |
+ std::max(typeWidthInBytesOnStack(ReturnType), SpillAreaSizeBytes); |
+ } |
+ |
// Align esp if necessary. |
if (NeedsStackAlignment) { |
uint32_t StackOffset = |