Skip to content

Commit

Permalink
[release/8.0] [mono][interp] Mask all shift amounts (#90991)
Browse files Browse the repository at this point in the history
* [tests] Enable tests

* [mono][interp] Mask all shift amounts

---------

Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
  • Loading branch information
github-actions[bot] and BrzVlad authored Aug 23, 2023
1 parent 303f1d3 commit 09e3266
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/mono/mono/mini/interp/interp-simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,57 +215,57 @@ interp_v128_i2_op_left_shift (gpointer res, gpointer v1, gpointer s1)
static void
interp_v128_i4_op_left_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i4*)res = *(v128_i4*)v1 << *(gint32*)s1;
*(v128_i4*)res = *(v128_i4*)v1 << (*(gint32*)s1 & 31);
}

static void
interp_v128_i8_op_left_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i8*)res = *(v128_i8*)v1 << *(gint32*)s1;
*(v128_i8*)res = *(v128_i8*)v1 << (*(gint32*)s1 & 63);
}

// op_RightShift
static void
interp_v128_i1_op_right_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i1*)res = *(v128_i1*)v1 >> *(gint32*)s1;
*(v128_i1*)res = *(v128_i1*)v1 >> (*(gint32*)s1 & 7);
}

static void
interp_v128_i2_op_right_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i2*)res = *(v128_i2*)v1 >> *(gint32*)s1;
*(v128_i2*)res = *(v128_i2*)v1 >> (*(gint32*)s1 & 15);
}

static void
interp_v128_i4_op_right_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i4*)res = *(v128_i4*)v1 >> *(gint32*)s1;
*(v128_i4*)res = *(v128_i4*)v1 >> (*(gint32*)s1 & 31);
}

// op_UnsignedRightShift
static void
interp_v128_i1_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_u1*)res = *(v128_u1*)v1 >> *(gint32*)s1;
*(v128_u1*)res = *(v128_u1*)v1 >> (*(gint32*)s1 & 7);
}

static void
interp_v128_i2_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_u2*)res = *(v128_u2*)v1 >> *(gint32*)s1;
*(v128_u2*)res = *(v128_u2*)v1 >> (*(gint32*)s1 & 15);
}

static void
interp_v128_i4_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_u4*)res = *(v128_u4*)v1 >> *(gint32*)s1;
*(v128_u4*)res = *(v128_u4*)v1 >> (*(gint32*)s1 & 31);
}

static void
interp_v128_i8_op_uright_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_u8*)res = *(v128_u8*)v1 >> *(gint32*)s1;
*(v128_u8*)res = *(v128_u8*)v1 >> (*(gint32*)s1 & 63);
}

// op_OnesComplement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace JIT.HardwareIntrinsics.General
public static partial class Program
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/89938", TestRuntimes.Mono)]
public static void {Method}{RetBaseType}{Imm}()
{
var test = new VectorImmBinaryOpTest__{Method}{RetBaseType}{Imm}();
Expand Down

0 comments on commit 09e3266

Please sign in to comment.