Skip to content

Commit 0912e94

Browse files
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
1 parent cb5acf5 commit 0912e94

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,6 @@ emit_vector_create_elementwise (
13421342
// optimizations can be enabled. This includes recognizing partial constants
13431343
// and only performing the minimal number of inserts required
13441344

1345-
gboolean all_const = true;
13461345
gboolean some_const = false;
13471346

13481347
guint8 cns_vec[16];
@@ -1352,10 +1351,8 @@ emit_vector_create_elementwise (
13521351
if (vector_size == 16) {
13531352
for (int i = 0; i < param_count; ++i) {
13541353
if (!is_const (args[i])) {
1355-
all_const = false;
1356-
break;
1354+
continue;
13571355
}
1358-
13591356
some_const = true;
13601357

13611358
if (type_enum_is_float (etype->type)) {
@@ -1418,10 +1415,6 @@ emit_vector_create_elementwise (
14181415
}
14191416
}
14201417

1421-
if (all_const) {
1422-
return emit_xconst_v128 (cfg, vklass, (guint8*)cns_vec);
1423-
}
1424-
14251418
MonoInst *ins;
14261419

14271420
if (some_const) {
@@ -1431,11 +1424,11 @@ emit_vector_create_elementwise (
14311424
}
14321425

14331426
for (int i = 0; i < param_count; ++i) {
1434-
if (!is_const (args[i]) || (vector_size != 16)) {
1435-
ins = emit_vector_insert_element (cfg, vklass, ins, etype->type, args[i], i, TRUE);
1427+
if (some_const && is_const (args[i])) {
1428+
continue;
14361429
}
1430+
ins = emit_vector_insert_element (cfg, vklass, ins, etype->type, args[i], i, TRUE);
14371431
}
1438-
14391432
return ins;
14401433
}
14411434

@@ -1484,8 +1477,7 @@ emit_vector_create_scalar (
14841477
} else {
14851478
g_assert (arg0->opcode == OP_I8CONST);
14861479
cns_val = arg0->inst_l;
1487-
1488-
}
1480+
}
14891481
switch (etype->type) {
14901482
case MONO_TYPE_I1:
14911483
case MONO_TYPE_U1: {

0 commit comments

Comments
 (0)