-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix HFA/HVA classification #37499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix HFA/HVA classification #37499
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1908,6 +1908,17 @@ typedef enum NativeTypeArrayFlags | |
ntaReserved = 0xfffe // All the reserved bits. | ||
} NativeTypeArrayFlags; | ||
|
||
// | ||
// Enum used for HFA type recognition. | ||
// Supported across architectures, so that it can be used in altjits and cross-compilation. | ||
typedef enum CorInfoHFAElemType : unsigned { | ||
CORINFO_HFA_ELEM_NONE, | ||
CORINFO_HFA_ELEM_FLOAT, | ||
CORINFO_HFA_ELEM_DOUBLE, | ||
CORINFO_HFA_ELEM_VECTOR64, | ||
CORINFO_HFA_ELEM_VECTOR128, | ||
Comment on lines
+1918
to
+1919
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically |
||
} CorInfoHFAElemType; | ||
|
||
// | ||
// Opaque types for security properties and values. | ||
// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10108,30 +10108,19 @@ unsigned Compiler::GetHfaCount(GenTree* tree) | |
|
||
var_types Compiler::GetHfaType(CORINFO_CLASS_HANDLE hClass) | ||
{ | ||
var_types result = TYP_UNDEF; | ||
#ifdef FEATURE_HFA | ||
if (hClass != NO_CLASS_HANDLE) | ||
{ | ||
#ifdef FEATURE_HFA | ||
CorInfoType corType = info.compCompHnd->getHFAType(hClass); | ||
#if defined(TARGET_ARM64) && defined(FEATURE_SIMD) | ||
if (corType == CORINFO_TYPE_VALUECLASS) | ||
CorInfoHFAElemType elemKind = info.compCompHnd->getHFAType(hClass); | ||
if (elemKind != CORINFO_HFA_ELEM_NONE) | ||
{ | ||
// This is a vector type. | ||
// HVAs are only supported on ARM64, and only for homogeneous aggregates of 8 or 16 byte vectors. | ||
// For 8-byte vectors corType will be returned as CORINFO_TYPE_DOUBLE. | ||
result = TYP_SIMD16; | ||
// This type may not appear elsewhere, but it will occupy a floating point register. | ||
compFloatingPointUsed = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it safe to drop There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, that was a mistake |
||
} | ||
else | ||
#endif // TARGET_ARM64 && FEATURE_SIMD | ||
if (corType != CORINFO_TYPE_UNDEF) | ||
{ | ||
result = JITtype2varType(corType); | ||
} | ||
#endif // FEATURE_HFA | ||
return HfaTypeFromElemKind(elemKind); | ||
} | ||
return result; | ||
#endif // FEATURE_HFA | ||
return TYP_UNDEF; | ||
} | ||
|
||
//------------------------------------------------------------------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There aren't any architectures that have HVA for Vector256?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like
__vectorcall
for x64 will eventually fit this bill: https://godbolt.org/z/DMX7Y2, but not for ARM32/ARM64 (which don't supportVector256<T>
) nor the default calling conventions for x86 or x64 on Unix/Windows.System V does treat a simple wrapper over
__m256
as if it was directly__m256
however, not sure if that is classified as an HFA/HVA by the JIT...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the runtime (JIT + VM) handles the System V ABI completely separately. HFA/HVA is ARM32/ARM64 only.