Skip to content

Commit

Permalink
ARm64/Sve: Fix the SVE_ComputeAddress* (#104039)
Browse files Browse the repository at this point in the history
* Fix the SVE_ComputeAddress*

* review comments

* fix the typo
  • Loading branch information
kunalspathak authored Jun 27, 2024
1 parent 6006e9a commit 3ed9deb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/coreclr/jit/hwintrinsic.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,10 @@ struct HWIntrinsicInfo
return static_cast<CORINFO_InstructionSet>(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)
Expand Down
25 changes: 25 additions & 0 deletions src/coreclr/jit/hwintrinsicarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/jit/hwintrinsiccodegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3ed9deb

Please sign in to comment.