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

Commit

Permalink
Generating code for hardware intrinsic
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung committed Sep 18, 2019
1 parent 560e737 commit 63a56b7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/tools/crossgen2/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,16 +674,23 @@ private uint getMethodAttribsInternal(MethodDesc method)
// Check for hardware intrinsics
if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(method))
{
#if !READYTORUN
// Do not report the get_IsSupported method as an intrinsic - RyuJIT would expand it to
// a constant depending on the code generation flags passed to it, but we would like to
// do a dynamic check instead.
if (!HardwareIntrinsicHelpers.IsIsSupportedMethod(method)
|| HardwareIntrinsicHelpers.IsKnownSupportedIntrinsicAtCompileTime(method))
#if !READYTORUN
|| HardwareIntrinsicHelpers.IsKnownSupportedIntrinsicAtCompileTime(method)
#endif
)
{
result |= CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC;
}
else
{
#if READYTORUN
result |= CorInfoFlag.CORINFO_FLG_DONT_INLINE;
#endif
}
}

result |= CorInfoFlag.CORINFO_FLG_NOSECURITYWRAP;
Expand Down Expand Up @@ -872,6 +879,12 @@ private bool isInSIMDModule(CORINFO_CLASS_STRUCT_* classHnd)
CORJIT_FLAGS flags = default(CORJIT_FLAGS);
getJitFlags(ref flags, (uint)sizeof(CORJIT_FLAGS));

#if READYTORUN
if (((DefType)type).InstanceFieldSize.IsIndeterminate)
{
throw new RequiresRuntimeJitException("Ooops");
}
#endif
Debug.Assert(!_simdHelper.IsVectorOfT(type)
|| ((DefType)type).InstanceFieldSize.AsInt == GetMaxIntrinsicSIMDVectorLength(_jit, &flags));
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ public override ICompilation ToCompilation()
corJitFlags.Add(CorJitFlag.CORJIT_FLAG_BBINSTR);

corJitFlags.Add(CorJitFlag.CORJIT_FLAG_PROF_REJIT_NOPS);
// _context.Target.MaximumSimdVectorLength?
corJitFlags.Add(CorJitFlag.CORJIT_FLAG_FEATURE_SIMD);

var jitConfig = new JitConfigProvider(corJitFlags, _ryujitOptions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ private static mdToken FindGenericMethodArgTypeSpec(EcmaModule module)

private bool ShouldSkipCompilation(IMethodNode methodCodeNodeNeedingCode)
{
return methodCodeNodeNeedingCode.Method.IsAggressiveOptimization;
if (methodCodeNodeNeedingCode.Method.IsAggressiveOptimization)
{
return true;
}
if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(methodCodeNodeNeedingCode.Method) && HardwareIntrinsicHelpers.IsIsSupportedMethod(methodCodeNodeNeedingCode.Method))
{
return true;
}
return false;
}

public void CompileMethod(IReadyToRunMethodCodeNode methodCodeNodeNeedingCode)
Expand Down

0 comments on commit 63a56b7

Please sign in to comment.