Skip to content

Commit 4ff7eca

Browse files
authored
[mono] Fix some asserts caused by #78182. (#78291)
Fixes #78290.
1 parent c59c010 commit 4ff7eca

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ get_vector_t_elem_type (MonoType *vector_type)
684684
}
685685

686686
static gboolean
687-
type_is_unsigned (MonoType *type) {
687+
type_is_unsigned (MonoType *type)
688+
{
688689
MonoClass *klass = mono_class_from_mono_type_internal (type);
689690
MonoType *etype = mono_class_get_context (klass)->class_inst->type_argv [0];
690691
return type_enum_is_unsigned (etype->type);
@@ -705,7 +706,8 @@ type_enum_is_unsigned (MonoTypeEnum type)
705706
}
706707

707708
static gboolean
708-
type_is_float (MonoType *type) {
709+
type_is_float (MonoType *type)
710+
{
709711
MonoClass *klass = mono_class_from_mono_type_internal (type);
710712
MonoType *etype = mono_class_get_context (klass)->class_inst->type_argv [0];
711713
return type_enum_is_float (etype->type);
@@ -2145,12 +2147,14 @@ emit_sys_numerics_vector_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSig
21452147
klass = cmethod->klass;
21462148
type = m_class_get_byval_arg (klass);
21472149
etype = mono_class_get_context (klass)->class_inst->type_argv [0];
2150+
2151+
if (!MONO_TYPE_IS_VECTOR_PRIMITIVE (etype))
2152+
return NULL;
2153+
21482154
size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL);
21492155
g_assert (size);
21502156
len = register_size / size;
21512157

2152-
if (!MONO_TYPE_IS_VECTOR_PRIMITIVE (etype))
2153-
return NULL;
21542158

21552159
if (cfg->verbose_level > 1) {
21562160
char *name = mono_method_full_name (cmethod, TRUE);
@@ -4193,13 +4197,14 @@ emit_vector256_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fs
41934197

41944198
klass = cmethod->klass;
41954199
etype = mono_class_get_context (klass)->class_inst->type_argv [0];
4196-
size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL);
4197-
g_assert (size);
4198-
len = 32 / size;
41994200

42004201
if (!MONO_TYPE_IS_VECTOR_PRIMITIVE (etype))
42014202
return NULL;
42024203

4204+
size = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL);
4205+
g_assert (size);
4206+
len = 32 / size;
4207+
42034208
if (cfg->verbose_level > 1) {
42044209
char *name = mono_method_full_name (cmethod, TRUE);
42054210
printf (" SIMD intrinsic %s\n", name);

0 commit comments

Comments
 (0)