[RyuJIT/armel] Passing stack double arguments
authorHanjoung Lee <hanjoung.lee@samsung.com>
Fri, 30 Jun 2017 09:17:07 +0000 (18:17 +0900)
committerHanjoung Lee <hanjoung.lee@samsung.com>
Mon, 3 Jul 2017 02:27:04 +0000 (11:27 +0900)
Fix #11927

src/jit/codegenarmarch.cpp
src/jit/lsraarmarch.cpp

index 5338a04..9a7839b 100644 (file)
@@ -555,6 +555,16 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
         {
             genConsumeReg(source);
             emit->emitIns_S_R(storeIns, storeAttr, source->gtRegNum, varNumOut, argOffsetOut);
+            if (compiler->opts.compUseSoftFP && targetType == TYP_LONG)
+            {
+                // This case currently only occurs for double types that are passed as TYP_LONG;
+                // actual long types would have been decomposed by now.
+                assert(source->IsCopyOrReload());
+                regNumber otherReg = (regNumber)source->AsCopyOrReload()->GetRegNumByIdx(1);
+                assert(otherReg != REG_NA);
+                argOffsetOut += EA_4BYTE;
+                emit->emitIns_S_R(storeIns, storeAttr, otherReg, varNumOut, argOffsetOut);
+            }
         }
         argOffsetOut += EA_SIZE_IN_BYTES(storeAttr);
         assert(argOffsetOut <= argOffsetMax); // We can't write beyound the outgoing area area
index e65cdfe..f45eb50 100644 (file)
@@ -738,8 +738,22 @@ void Lowering::TreeNodeInfoInitPutArgStk(GenTreePutArgStk* argNode, fgArgTabEntr
     else
     {
 #ifdef _TARGET_ARM_
+
+#ifndef ARM_SOFTFP
         // We must not have a multi-reg struct; double uses 2 slots and isn't a multi-reg struct
         assert((info->numSlots == 1) || ((info->numSlots == 2) && (putArgChild->TypeGet() == TYP_DOUBLE)));
+#else  // ARM_SOFTFP
+        // The `double` types have been transformed to `long` on armel.
+        if ((info->numSlots == 2) && (putArgChild->TypeGet() == TYP_LONG))
+        {
+            argNode->gtLsraInfo.srcCount = 2;
+        }
+        else
+        {
+            assert(info->numSlots == 1);
+        }
+#endif // ARM_SOFTFP
+
 #else  // !_TARGET_ARM_
         // We must not have a multi-reg struct
         assert(info->numSlots == 1);