Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
CarolEidt committed Apr 13, 2019
1 parent 2c5a026 commit dd186f2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10208,7 +10208,7 @@ var_types Compiler::GetHfaType(CORINFO_CLASS_HANDLE hClass)
if (corType == CORINFO_TYPE_VALUECLASS)
{
// This is a vector type.
// HVAs are only supported on ARM64, and only for sizes of 8 or 16 bytes.
// 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.
Expand Down
6 changes: 3 additions & 3 deletions src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,9 @@ var_types Compiler::getArgTypeForStruct(CORINFO_CLASS_HANDLE clsHnd,
//
if (structSize <= MAX_PASS_MULTIREG_BYTES)
{
// Structs that are HFA's are passed by value in multiple registers.
// Arm64 Windows VarArg methods arguments will not classify HFA types, they will need to be treated
// as if they are not HFA types.
// Structs that are HFA/HVA's are passed by value in multiple registers.
// Arm64 Windows VarArg methods arguments will not classify HFA/HVA types, they will need to be treated
// as if they are not HFA/HVA types.
var_types hfaType;
#if defined(_TARGET_WINDOWS_) && defined(_TARGET_ARM64_)
if (isVarArg)
Expand Down
3 changes: 3 additions & 0 deletions src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,15 @@ class LclVarDsc
assert(!"lvHfaSlots called for non-HFA");
break;
case HFA_ELEM_FLOAT:
assert((lvExactSize % 4) == 0);
slots = lvExactSize >> 2;
break;
case HFA_ELEM_DOUBLE:
assert((lvExactSize % 8) == 0);
slots = lvExactSize >> 3;
break;
case HFA_ELEM_SIMD16:
assert((lvExactSize % 16) == 0);
slots = lvExactSize >> 4;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/jit/dll/jit.nativeproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<LinkModuleDefinitionFile>$(OutputName).def</LinkModuleDefinitionFile>

<ClDefines Condition="'$(BuildArchitecture)' == 'amd64' or '$(BuildArchitecture)' == 'arm64'">$(ClDefines);FEATURE_SIMD</ClDefines>
<ClDefines Condition="'$(BuildArchitecture)' == 'amd64'">$(ClDefines);FEATURE_SIMD</ClDefines>

<Win32DllLibs>$(SdkLibPath)\kernel32.lib;$(SdkLibPath)\user32.lib;$(SdkLibPath)\advapi32.lib;$(SdkLibPath)\oleaut32.lib;$(SdkLibPath)\uuid.lib</Win32DllLibs>
<Win32DllLibs>$(Win32DllLibs);$(ClrLibPath)\utilcode.lib</Win32DllLibs>
Expand Down
2 changes: 1 addition & 1 deletion src/vm/callhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct CallDescrData
#ifdef ENREGISTERED_RETURNTYPE_MAXSIZE
#ifdef _TARGET_ARM64_
// Use NEON128 to ensure proper alignment for vectors.
__declspec(align(16)) NEON128 returnValue[ENREGISTERED_RETURNTYPE_MAXSIZE / sizeof(NEON128)];
DECLSPEC_ALIGN(16) NEON128 returnValue[ENREGISTERED_RETURNTYPE_MAXSIZE / sizeof(NEON128)];
#else
// Use UINT64 to ensure proper alignment
UINT64 returnValue[ENREGISTERED_RETURNTYPE_MAXSIZE / sizeof(UINT64)];
Expand Down
59 changes: 21 additions & 38 deletions src/vm/callingconvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,22 @@ struct ArgLocDesc
#endif // UNIX_AMD64_ABI

#if defined(_TARGET_ARM64_)
int m_hfaFieldSize; // Size of HFA field
unsigned m_hfaFieldSize; // Size of HFA field in bytes.
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;
}
}
void setHFAFieldSize(CorElementType hfaType)
{
m_hfaFieldSize = getHFAFieldSize(hfaType);
}
#endif // defined(_TARGET_ARM64_)

#if defined(_TARGET_ARM_)
Expand Down Expand Up @@ -588,19 +603,9 @@ class ArgIteratorTemplate : public ARGITERATOR_BASE
if (!m_argTypeHandle.IsNull() && m_argTypeHandle.IsHFA())
{
CorElementType type = m_argTypeHandle.GetHFAType();
int hfaFieldSize = 0;
switch (type)
{
case ELEMENT_TYPE_R4: hfaFieldSize = 4; break;
case ELEMENT_TYPE_R8: hfaFieldSize = 8; break;
#ifdef _TARGET_ARM64_
case ELEMENT_TYPE_VALUETYPE: hfaFieldSize = 16; break;
#endif
default: _ASSERTE(!"Invalid HFA Type");
}
pLoc->setHFAFieldSize(type);
pLoc->m_cFloatReg = GetArgSize()/pLoc->m_hfaFieldSize;

pLoc->m_cFloatReg = GetArgSize()/hfaFieldSize;
pLoc->m_hfaFieldSize = hfaFieldSize;
}
else
{
Expand Down Expand Up @@ -1306,23 +1311,11 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
{
CorElementType type = thValueType.GetHFAType();

int hfaFieldSize = 0;
switch (type)
{
case ELEMENT_TYPE_R4: hfaFieldSize = 4; break;
case ELEMENT_TYPE_R8: hfaFieldSize = 8; break;
#ifdef _TARGET_ARM64_
case ELEMENT_TYPE_VALUETYPE: hfaFieldSize = 16; break;
#endif
default: _ASSERTE(!"Invalid HFA Type");
}
cFPRegs = argSize/hfaFieldSize;

m_argLocDescForStructInRegs.Init();
m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;

m_argLocDescForStructInRegs.m_hfaFieldSize = hfaFieldSize;
m_argLocDescForStructInRegs.setHFAFieldSize(type);
m_argLocDescForStructInRegs.m_cFloatReg = argSize/m_argLocDescForStructInRegs.m_hfaFieldSize;

m_hasArgLocDescForStructInRegs = true;
}
Expand Down Expand Up @@ -1491,18 +1484,8 @@ void ArgIteratorTemplate<ARGITERATOR_BASE>::ComputeReturnFlags()
{
CorElementType hfaType = thValueType.GetHFAType();

int hfaFieldSize = 0;
switch (hfaType)
{
case ELEMENT_TYPE_R4: hfaFieldSize = 4; break;
case ELEMENT_TYPE_R8: hfaFieldSize = 8; break;
#ifdef _TARGET_ARM64_
case ELEMENT_TYPE_VALUETYPE: hfaFieldSize = 16; break;
#endif
default: _ASSERTE(!"Invalid HFA Type");
}
int hfaFieldSize = ArgLocDesc::getHFAFieldSize(hfaType);
flags |= ((4 * hfaFieldSize) << RETURN_FP_SIZE_SHIFT);

break;
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/vm/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,8 @@ class EEClassLayoutInfo
void SetNativeHFAType(CorElementType hfaType)
{
LIMITED_METHOD_CONTRACT;
// We should call this at most once.
_ASSERTE((m_bFlags & e_HFATypeFlags) == 0);
switch (hfaType)
{
case ELEMENT_TYPE_R4: m_bFlags |= e_R4_HFA; break;
Expand Down

0 comments on commit dd186f2

Please sign in to comment.