From 0912e94a6c81f4743946831137ba6c3ec3f1a179 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sun, 28 Jul 2024 09:58:43 -0700 Subject: [PATCH] Don't create a constant node for Vector64 (#105538) * Don't create a constant node for Vector64 * Ensure we process all arguments so the some_const case is correct --- src/mono/mono/mini/simd-intrinsics.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/mono/mono/mini/simd-intrinsics.c b/src/mono/mono/mini/simd-intrinsics.c index 54588a2f2dfdf..b387323b19312 100644 --- a/src/mono/mono/mini/simd-intrinsics.c +++ b/src/mono/mono/mini/simd-intrinsics.c @@ -1342,7 +1342,6 @@ emit_vector_create_elementwise ( // optimizations can be enabled. This includes recognizing partial constants // and only performing the minimal number of inserts required - gboolean all_const = true; gboolean some_const = false; guint8 cns_vec[16]; @@ -1352,10 +1351,8 @@ emit_vector_create_elementwise ( if (vector_size == 16) { for (int i = 0; i < param_count; ++i) { if (!is_const (args[i])) { - all_const = false; - break; + continue; } - some_const = true; if (type_enum_is_float (etype->type)) { @@ -1418,10 +1415,6 @@ emit_vector_create_elementwise ( } } - if (all_const) { - return emit_xconst_v128 (cfg, vklass, (guint8*)cns_vec); - } - MonoInst *ins; if (some_const) { @@ -1431,11 +1424,11 @@ emit_vector_create_elementwise ( } for (int i = 0; i < param_count; ++i) { - if (!is_const (args[i]) || (vector_size != 16)) { - ins = emit_vector_insert_element (cfg, vklass, ins, etype->type, args[i], i, TRUE); + if (some_const && is_const (args[i])) { + continue; } + ins = emit_vector_insert_element (cfg, vklass, ins, etype->type, args[i], i, TRUE); } - return ins; } @@ -1484,8 +1477,7 @@ emit_vector_create_scalar ( } else { g_assert (arg0->opcode == OP_I8CONST); cns_val = arg0->inst_l; - -} + } switch (etype->type) { case MONO_TYPE_I1: case MONO_TYPE_U1: {