Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1442753008: Reserve space for scalar FP returns in the stack frame (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInstX86BaseImpl.h ('k') | tests_lit/llvm2ice_tests/commutativity.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index e8a86d87e0fd32c0b4fc34a756833fb5515926c5..e8bd77184d619a5429ca80731e3cb9f9e8abf2a0 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.
+ const Type ReturnType = Func->getReturnType();
+ 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 =
« no previous file with comments | « src/IceInstX86BaseImpl.h ('k') | tests_lit/llvm2ice_tests/commutativity.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698