Skip to content

[mono][interp] Fix incorrect masking #82890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mono/mono/mini/interp/interp-simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ interp_v128_i4_op_negation (gpointer res, gpointer v1)
static void
interp_v128_i1_op_left_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i1*)res = *(v128_i1*)v1 << (*(gint32*)s1 & 0x7);
*(v128_i1*)res = *(v128_i1*)v1 << (*(gint32*)s1 & 7);
}

static void
interp_v128_i2_op_left_shift (gpointer res, gpointer v1, gpointer s1)
{
*(v128_i2*)res = *(v128_i2*)v1 << (*(gint32*)s1 & 0x15);
*(v128_i2*)res = *(v128_i2*)v1 << (*(gint32*)s1 & 15);
}

static void
Expand Down
3 changes: 1 addition & 2 deletions src/mono/mono/mini/interp/transform-simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ emit_sri_vector128 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature
if (id == -1)
return FALSE;

MonoClass *vector_klass = mono_class_from_mono_type_internal (csignature->ret);
if (id == SN_get_IsHardwareAccelerated) {
interp_add_ins (td, MINT_LDC_I4_1);
goto opcode_added;
}

gint16 simd_opcode = -1;
gint16 simd_intrins = -1;

MonoClass *vector_klass = mono_class_from_mono_type_internal (csignature->ret);
if (!m_class_is_simd_type (vector_klass))
vector_klass = mono_class_from_mono_type_internal (csignature->params [0]);
if (!m_class_is_simd_type (vector_klass))
Expand Down