}
private:
- unsigned getSIMDInitTempVarNum()
- {
- if (lvaSIMDInitTempVarNum == BAD_VAR_NUM)
- {
- lvaSIMDInitTempVarNum = lvaGrabTempWithImplicitUse(false DEBUGARG("SIMDInitTempVar"));
- lvaTable[lvaSIMDInitTempVarNum].lvType = getSIMDVectorType();
- }
- return lvaSIMDInitTempVarNum;
- }
+ unsigned getSIMDInitTempVarNum(var_types simdType);
#else // !FEATURE_SIMD
bool isOpaqueSIMDLclVar(LclVarDsc* varDsc)
{
// If the index is not a constant or op1 is in register,
// we will use the SIMD temp location to store the vector.
- compiler->getSIMDInitTempVarNum();
+ var_types requiredSimdTempType = (intrin.id == NI_Vector64_GetElement) ? TYP_SIMD8 : TYP_SIMD16;
+ compiler->getSIMDInitTempVarNum(requiredSimdTempType);
}
}
{
// If the index is not a constant or op1 is in register,
// we will use the SIMD temp location to store the vector.
- compiler->getSIMDInitTempVarNum();
+ var_types requiredSimdTempType = (intrinsicId == NI_Vector128_GetElement) ? TYP_SIMD16 : TYP_SIMD32;
+ compiler->getSIMDInitTempVarNum(requiredSimdTempType);
}
break;
}
#endif
}
+//------------------------------------------------------------------------
+// Get, and allocate if necessary, the SIMD temp used for various operations.
+// The temp is allocated as the maximum sized type of all operations required.
+//
+// Arguments:
+// simdType - Required SIMD type
+//
+// Returns:
+// The temp number
+//
+unsigned Compiler::getSIMDInitTempVarNum(var_types simdType)
+{
+ if (lvaSIMDInitTempVarNum == BAD_VAR_NUM)
+ {
+ JITDUMP("Allocating SIMDInitTempVar as %s\n", varTypeName(simdType));
+ lvaSIMDInitTempVarNum = lvaGrabTempWithImplicitUse(false DEBUGARG("SIMDInitTempVar"));
+ lvaTable[lvaSIMDInitTempVarNum].lvType = simdType;
+ }
+ else if (genTypeSize(lvaTable[lvaSIMDInitTempVarNum].lvType) < genTypeSize(simdType))
+ {
+ // We want the largest required type size for the temp.
+ JITDUMP("Increasing SIMDInitTempVar type size from %s to %s\n",
+ varTypeName(lvaTable[lvaSIMDInitTempVarNum].lvType), varTypeName(simdType));
+ lvaTable[lvaSIMDInitTempVarNum].lvType = simdType;
+ }
+ return lvaSIMDInitTempVarNum;
+}
+
//----------------------------------------------------------------------------------
// Return the base type and size of SIMD vector type given its type handle.
//