Skip to content

Commit 3ed9deb

Browse files
authored
ARm64/Sve: Fix the SVE_ComputeAddress* (#104039)
* Fix the SVE_ComputeAddress* * review comments * fix the typo
1 parent 6006e9a commit 3ed9deb

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

src/coreclr/jit/hwintrinsic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,10 @@ struct HWIntrinsicInfo
555555
return static_cast<CORINFO_InstructionSet>(result);
556556
}
557557

558-
#ifdef TARGET_XARCH
558+
#if defined(TARGET_XARCH)
559559
static int lookupIval(Compiler* comp, NamedIntrinsic id, var_types simdBaseType);
560+
#elif defined(TARGET_ARM64)
561+
static int lookupIval(NamedIntrinsic id);
560562
#endif
561563

562564
static bool tryLookupSimdSize(NamedIntrinsic id, unsigned* pSimdSize)

src/coreclr/jit/hwintrinsicarm64.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,31 @@ CORINFO_InstructionSet HWIntrinsicInfo::lookupIsa(const char* className, const c
152152
return InstructionSet_ILLEGAL;
153153
}
154154

155+
//------------------------------------------------------------------------
156+
// lookupIval: Gets a the implicit immediate value for the given intrinsic
157+
//
158+
// Arguments:
159+
// id - The intrinsic for which to get the ival
160+
//
161+
// Return Value:
162+
// The immediate value for the given intrinsic or -1 if none exists
163+
int HWIntrinsicInfo::lookupIval(NamedIntrinsic id)
164+
{
165+
switch (id)
166+
{
167+
case NI_Sve_Compute16BitAddresses:
168+
return 1;
169+
case NI_Sve_Compute32BitAddresses:
170+
return 2;
171+
case NI_Sve_Compute64BitAddresses:
172+
return 3;
173+
case NI_Sve_Compute8BitAddresses:
174+
return 0;
175+
default:
176+
unreached();
177+
}
178+
return -1;
179+
}
155180
//------------------------------------------------------------------------
156181
// isFullyImplementedIsa: Gets a value that indicates whether the InstructionSet is fully implemented
157182
//

src/coreclr/jit/hwintrinsiccodegenarm64.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,12 +2118,8 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
21182118
case NI_Sve_Compute32BitAddresses:
21192119
case NI_Sve_Compute64BitAddresses:
21202120
{
2121-
static_assert_no_msg(AreContiguous(NI_Sve_Compute16BitAddresses, NI_Sve_Compute32BitAddresses,
2122-
NI_Sve_Compute64BitAddresses, NI_Sve_Compute8BitAddresses));
2123-
21242121
GetEmitter()->emitInsSve_R_R_R_I(ins, EA_SCALABLE, targetReg, op1Reg, op2Reg,
2125-
(intrin.id - NI_Sve_Compute16BitAddresses), opt,
2126-
INS_SCALABLE_OPTS_LSL_N);
2122+
HWIntrinsicInfo::lookupIval(intrin.id), opt, INS_SCALABLE_OPTS_LSL_N);
21272123
break;
21282124
}
21292125

0 commit comments

Comments
 (0)