diff --git a/src/coreclr/jit/hwintrinsic.h b/src/coreclr/jit/hwintrinsic.h index 3c63cb79b3c65..1a959ec50e797 100644 --- a/src/coreclr/jit/hwintrinsic.h +++ b/src/coreclr/jit/hwintrinsic.h @@ -555,8 +555,10 @@ struct HWIntrinsicInfo return static_cast(result); } -#ifdef TARGET_XARCH +#if defined(TARGET_XARCH) static int lookupIval(Compiler* comp, NamedIntrinsic id, var_types simdBaseType); +#elif defined(TARGET_ARM64) + static int lookupIval(NamedIntrinsic id); #endif static bool tryLookupSimdSize(NamedIntrinsic id, unsigned* pSimdSize) diff --git a/src/coreclr/jit/hwintrinsicarm64.cpp b/src/coreclr/jit/hwintrinsicarm64.cpp index 765f433e614ee..b63c872db29a9 100644 --- a/src/coreclr/jit/hwintrinsicarm64.cpp +++ b/src/coreclr/jit/hwintrinsicarm64.cpp @@ -152,6 +152,31 @@ CORINFO_InstructionSet HWIntrinsicInfo::lookupIsa(const char* className, const c return InstructionSet_ILLEGAL; } +//------------------------------------------------------------------------ +// lookupIval: Gets a the implicit immediate value for the given intrinsic +// +// Arguments: +// id - The intrinsic for which to get the ival +// +// Return Value: +// The immediate value for the given intrinsic or -1 if none exists +int HWIntrinsicInfo::lookupIval(NamedIntrinsic id) +{ + switch (id) + { + case NI_Sve_Compute16BitAddresses: + return 1; + case NI_Sve_Compute32BitAddresses: + return 2; + case NI_Sve_Compute64BitAddresses: + return 3; + case NI_Sve_Compute8BitAddresses: + return 0; + default: + unreached(); + } + return -1; +} //------------------------------------------------------------------------ // isFullyImplementedIsa: Gets a value that indicates whether the InstructionSet is fully implemented // diff --git a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp index ed59e82e5823f..3cbf803d3b076 100644 --- a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp @@ -2118,12 +2118,8 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) case NI_Sve_Compute32BitAddresses: case NI_Sve_Compute64BitAddresses: { - static_assert_no_msg(AreContiguous(NI_Sve_Compute16BitAddresses, NI_Sve_Compute32BitAddresses, - NI_Sve_Compute64BitAddresses, NI_Sve_Compute8BitAddresses)); - GetEmitter()->emitInsSve_R_R_R_I(ins, EA_SCALABLE, targetReg, op1Reg, op2Reg, - (intrin.id - NI_Sve_Compute16BitAddresses), opt, - INS_SCALABLE_OPTS_LSL_N); + HWIntrinsicInfo::lookupIval(intrin.id), opt, INS_SCALABLE_OPTS_LSL_N); break; }