Skip to content

Commit

Permalink
Add RCPC ISA detection on win-arm64 (#82527)
Browse files Browse the repository at this point in the history
* Add RCPC ISA detection on win-arm64

* Address feedback
  • Loading branch information
EgorBo authored Feb 23, 2023
1 parent ef43934 commit c34ecd8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,18 @@ REDHAWK_PALIMPORT void REDHAWK_PALAPI PAL_GetCpuCapabilityFlags(int* flags)
{
*flags = 0;

// Older version of SDK would return false for these intrinsics
// but make sure we pass the right values to the APIs
#ifndef PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE
#define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
#endif
#ifndef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
#define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
#endif
#ifndef PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE
#define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
#endif

// FP and SIMD support are enabled by default
*flags |= ARM64IntrinsicConstants_AdvSimd;

Expand All @@ -780,6 +792,16 @@ REDHAWK_PALIMPORT void REDHAWK_PALAPI PAL_GetCpuCapabilityFlags(int* flags)
{
*flags |= ARM64IntrinsicConstants_Atomics;
}

if (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE))
{
*flags |= ARM64IntrinsicConstants_Dp;
}

if (IsProcessorFeaturePresent(PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE))
{
*flags |= ARM64IntrinsicConstants_Rcpc;
}
}

#endif
11 changes: 10 additions & 1 deletion src/coreclr/vm/codeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,10 @@ void EEJitManager::SetCpuInfo()
#define PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE 34
#endif
#ifndef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
# define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
#define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
#endif
#ifndef PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE
#define PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE 45
#endif

// PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE (34)
Expand All @@ -1671,6 +1674,12 @@ void EEJitManager::SetCpuInfo()
CPUCompileFlags.Set(InstructionSet_Dp);
}

// PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE (45)
if (IsProcessorFeaturePresent(PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE))
{
CPUCompileFlags.Set(InstructionSet_Rcpc);
}

#endif // HOST_64BIT
if (GetDataCacheZeroIDReg() == 4)
{
Expand Down

0 comments on commit c34ecd8

Please sign in to comment.