summaryrefslogtreecommitdiff
path: root/src/vm/callingconvention.h
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2019-04-16 09:35:49 -0700
committerGitHub <noreply@github.com>2019-04-16 09:35:49 -0700
commit5be6b66ff3597df6a1ce3b66a8cf65b0beb40856 (patch)
treea40d84e300782a3da0b33386086f629da646f98e /src/vm/callingconvention.h
parent11a3859c10dcc20a6c5865135334f4df62d2358c (diff)
downloadcoreclr-5be6b66ff3597df6a1ce3b66a8cf65b0beb40856.tar.gz
coreclr-5be6b66ff3597df6a1ce3b66a8cf65b0beb40856.tar.bz2
coreclr-5be6b66ff3597df6a1ce3b66a8cf65b0beb40856.zip
Arm64 vector ABI (#23675)
* Support for Arm64 Vector ABI Extend HFA support to support vectors as well as floating point types. This requires that the JIT recognize vector types even during crossgen, so that the ABI is supported consistently. Also, fix and re-enable the disabled Arm64 Simd tests. Fix #16022
Diffstat (limited to 'src/vm/callingconvention.h')
-rw-r--r--src/vm/callingconvention.h43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/vm/callingconvention.h b/src/vm/callingconvention.h
index 7368fecac8..cbc6aad5c4 100644
--- a/src/vm/callingconvention.h
+++ b/src/vm/callingconvention.h
@@ -49,9 +49,25 @@ struct ArgLocDesc
#endif // UNIX_AMD64_ABI
+#ifdef FEATURE_HFA
+ static unsigned getHFAFieldSize(CorElementType hfaType)
+ {
+ switch (hfaType)
+ {
+ case ELEMENT_TYPE_R4: return 4;
+ case ELEMENT_TYPE_R8: return 8;
+ // We overload VALUETYPE for 16-byte vectors.
+ case ELEMENT_TYPE_VALUETYPE: return 16;
+ default: _ASSERTE(!"Invalid HFA Type"); return 0;
+ }
+ }
+#endif
#if defined(_TARGET_ARM64_)
- bool m_isSinglePrecision; // For determining if HFA is single or double
- // precision
+ unsigned m_hfaFieldSize; // Size of HFA field in bytes.
+ void setHFAFieldSize(CorElementType hfaType)
+ {
+ m_hfaFieldSize = getHFAFieldSize(hfaType);
+ }
#endif // defined(_TARGET_ARM64_)
#if defined(_TARGET_ARM_)
@@ -76,7 +92,7 @@ struct ArgLocDesc
m_fRequires64BitAlignment = FALSE;
#endif
#if defined(_TARGET_ARM64_)
- m_isSinglePrecision = FALSE;
+ m_hfaFieldSize = 0;
#endif // defined(_TARGET_ARM64_)
#if defined(UNIX_AMD64_ABI)
m_eeClass = NULL;
@@ -589,10 +605,9 @@ public:
if (!m_argTypeHandle.IsNull() && m_argTypeHandle.IsHFA())
{
CorElementType type = m_argTypeHandle.GetHFAType();
- bool isFloatType = (type == ELEMENT_TYPE_R4);
+ pLoc->setHFAFieldSize(type);
+ pLoc->m_cFloatReg = GetArgSize()/pLoc->m_hfaFieldSize;
- pLoc->m_cFloatReg = isFloatType ? GetArgSize()/sizeof(float): GetArgSize()/sizeof(double);
- pLoc->m_isSinglePrecision = isFloatType;
}
else
{
@@ -1297,16 +1312,14 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
if (thValueType.IsHFA())
{
CorElementType type = thValueType.GetHFAType();
- bool isFloatType = (type == ELEMENT_TYPE_R4);
-
- cFPRegs = (type == ELEMENT_TYPE_R4)? (argSize/sizeof(float)): (argSize/sizeof(double));
m_argLocDescForStructInRegs.Init();
- m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
- m_argLocDescForStructInRegs.m_isSinglePrecision = isFloatType;
-
+ m_argLocDescForStructInRegs.setHFAFieldSize(type);
+ cFPRegs = argSize/m_argLocDescForStructInRegs.m_hfaFieldSize;
+ m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
+
m_hasArgLocDescForStructInRegs = true;
}
else
@@ -1474,10 +1487,8 @@ void ArgIteratorTemplate<ARGITERATOR_BASE>::ComputeReturnFlags()
{
CorElementType hfaType = thValueType.GetHFAType();
- flags |= (hfaType == ELEMENT_TYPE_R4) ?
- ((4 * sizeof(float)) << RETURN_FP_SIZE_SHIFT) :
- ((4 * sizeof(double)) << RETURN_FP_SIZE_SHIFT);
-
+ int hfaFieldSize = ArgLocDesc::getHFAFieldSize(hfaType);
+ flags |= ((4 * hfaFieldSize) << RETURN_FP_SIZE_SHIFT);
break;
}
#endif