Skip to content

Commit fb1d318

Browse files
authored
Enable NI_Vector256_Create on AVX1 (#72522)
1 parent e83493e commit fb1d318

File tree

6 files changed

+748
-1345
lines changed

6 files changed

+748
-1345
lines changed

src/coreclr/jit/hwintrinsic.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ NamedIntrinsic HWIntrinsicInfo::lookupId(Compiler* comp,
319319
// ISA is unsupported. For Vector256 this is when AVX2 is unsupported since integer types
320320
// can't get properly accelerated.
321321

322+
// We support some Vector256 intrinsics on AVX-only CPUs
323+
bool isLimitedVector256Isa = false;
324+
322325
if (isa == InstructionSet_Vector128)
323326
{
324327
if (!comp->IsBaselineSimdIsaSupported())
@@ -331,7 +334,14 @@ NamedIntrinsic HWIntrinsicInfo::lookupId(Compiler* comp,
331334
{
332335
if (!comp->compOpportunisticallyDependsOn(InstructionSet_AVX2))
333336
{
334-
return NI_Illegal;
337+
if (comp->compOpportunisticallyDependsOn(InstructionSet_AVX))
338+
{
339+
isLimitedVector256Isa = true;
340+
}
341+
else
342+
{
343+
return NI_Illegal;
344+
}
335345
}
336346
}
337347
#elif defined(TARGET_ARM64)
@@ -362,7 +372,16 @@ NamedIntrinsic HWIntrinsicInfo::lookupId(Compiler* comp,
362372

363373
if (strcmp(methodName, intrinsicInfo.name) == 0)
364374
{
365-
return intrinsicInfo.id;
375+
NamedIntrinsic ni = intrinsicInfo.id;
376+
377+
#if defined(TARGET_XARCH)
378+
// on AVX1-only CPUs we only support NI_Vector256_Create intrinsic in Vector256
379+
if (isLimitedVector256Isa && (ni != NI_Vector256_Create))
380+
{
381+
return NI_Illegal;
382+
}
383+
#endif
384+
return ni;
366385
}
367386
}
368387

0 commit comments

Comments
 (0)