From 629cd94b141e26c5c39074c456d2e68b69f35937 Mon Sep 17 00:00:00 2001 From: Vlad Brezae Date: Mon, 13 Feb 2023 10:59:26 +0200 Subject: [PATCH] [mono][interp] Don't emit intrinsics for unsupported vector types --- src/mono/mono/mini/interp/transform-simd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mono/mono/mini/interp/transform-simd.c b/src/mono/mono/mini/interp/transform-simd.c index 9f78b8db34296..ed2ef76c880ef 100644 --- a/src/mono/mono/mini/interp/transform-simd.c +++ b/src/mono/mono/mini/interp/transform-simd.c @@ -104,8 +104,13 @@ emit_sri_vector128 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature vector_klass = mono_class_from_mono_type_internal (csignature->params [0]); if (!m_class_is_simd_type (vector_klass)) return FALSE; + MonoType *arg_type = mono_class_get_context (vector_klass)->class_inst->type_argv [0]; + if (!mono_type_is_primitive (arg_type)) + return FALSE; MonoTypeEnum atype = arg_type->type; + if (atype == MONO_TYPE_BOOLEAN) + return FALSE; int vector_size = mono_class_value_size (vector_klass, NULL); int arg_size = mono_class_value_size (mono_class_from_mono_type_internal (arg_type), NULL); g_assert (vector_size == SIZEOF_V128); @@ -280,7 +285,11 @@ emit_sri_vector128_t (TransformData *td, MonoMethod *cmethod, MonoMethodSignatur // First argument is always vector MonoClass *vector_klass = cmethod->klass; MonoType *arg_type = mono_class_get_context (vector_klass)->class_inst->type_argv [0]; + if (!mono_type_is_primitive (arg_type)) + return FALSE; MonoTypeEnum atype = arg_type->type; + if (atype == MONO_TYPE_BOOLEAN) + return FALSE; int vector_size = mono_class_value_size (vector_klass, NULL); int arg_size = mono_class_value_size (mono_class_from_mono_type_internal (arg_type), NULL); g_assert (vector_size == SIZEOF_V128);