Skip to content

Commit 03854e8

Browse files
authored
[mono][interp] Mask all shift amounts (#90666)
* [tests] Enable tests * [mono][interp] Mask all shift amounts
1 parent 3ef2c80 commit 03854e8

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/mono/mono/mini/interp/interp-simd.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,57 +215,57 @@ interp_v128_i2_op_left_shift (gpointer res, gpointer v1, gpointer s1)
215215
static void
216216
interp_v128_i4_op_left_shift (gpointer res, gpointer v1, gpointer s1)
217217
{
218-
*(v128_i4*)res = *(v128_i4*)v1 << *(gint32*)s1;
218+
*(v128_i4*)res = *(v128_i4*)v1 << (*(gint32*)s1 & 31);
219219
}
220220

221221
static void
222222
interp_v128_i8_op_left_shift (gpointer res, gpointer v1, gpointer s1)
223223
{
224-
*(v128_i8*)res = *(v128_i8*)v1 << *(gint32*)s1;
224+
*(v128_i8*)res = *(v128_i8*)v1 << (*(gint32*)s1 & 63);
225225
}
226226

227227
// op_RightShift
228228
static void
229229
interp_v128_i1_op_right_shift (gpointer res, gpointer v1, gpointer s1)
230230
{
231-
*(v128_i1*)res = *(v128_i1*)v1 >> *(gint32*)s1;
231+
*(v128_i1*)res = *(v128_i1*)v1 >> (*(gint32*)s1 & 7);
232232
}
233233

234234
static void
235235
interp_v128_i2_op_right_shift (gpointer res, gpointer v1, gpointer s1)
236236
{
237-
*(v128_i2*)res = *(v128_i2*)v1 >> *(gint32*)s1;
237+
*(v128_i2*)res = *(v128_i2*)v1 >> (*(gint32*)s1 & 15);
238238
}
239239

240240
static void
241241
interp_v128_i4_op_right_shift (gpointer res, gpointer v1, gpointer s1)
242242
{
243-
*(v128_i4*)res = *(v128_i4*)v1 >> *(gint32*)s1;
243+
*(v128_i4*)res = *(v128_i4*)v1 >> (*(gint32*)s1 & 31);
244244
}
245245

246246
// op_UnsignedRightShift
247247
static void
248248
interp_v128_i1_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
249249
{
250-
*(v128_u1*)res = *(v128_u1*)v1 >> *(gint32*)s1;
250+
*(v128_u1*)res = *(v128_u1*)v1 >> (*(gint32*)s1 & 7);
251251
}
252252

253253
static void
254254
interp_v128_i2_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
255255
{
256-
*(v128_u2*)res = *(v128_u2*)v1 >> *(gint32*)s1;
256+
*(v128_u2*)res = *(v128_u2*)v1 >> (*(gint32*)s1 & 15);
257257
}
258258

259259
static void
260260
interp_v128_i4_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
261261
{
262-
*(v128_u4*)res = *(v128_u4*)v1 >> *(gint32*)s1;
262+
*(v128_u4*)res = *(v128_u4*)v1 >> (*(gint32*)s1 & 31);
263263
}
264264

265265
static void
266266
interp_v128_i8_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
267267
{
268-
*(v128_u8*)res = *(v128_u8*)v1 >> *(gint32*)s1;
268+
*(v128_u8*)res = *(v128_u8*)v1 >> (*(gint32*)s1 & 63);
269269
}
270270

271271
// op_OnesComplement

src/tests/JIT/HardwareIntrinsics/General/Shared/VectorImmBinaryOperatorTest.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace JIT.HardwareIntrinsics.General
1919
public static partial class Program
2020
{
2121
[Fact]
22-
[ActiveIssue("https://github.com/dotnet/runtime/issues/89938", TestRuntimes.Mono)]
2322
public static void {Method}{RetBaseType}{Imm}()
2423
{
2524
var test = new VectorImmBinaryOpTest__{Method}{RetBaseType}{Imm}();

0 commit comments

Comments
 (0)