Skip to content

Commit

Permalink
Don't create a constant node for Vector64 (#105538)
Browse files Browse the repository at this point in the history
* Don't create a constant node for Vector64

* Ensure we process all arguments so the some_const case is correct
  • Loading branch information
tannergooding authored Jul 28, 2024
1 parent cb5acf5 commit 0912e94
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/mono/mono/mini/simd-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 0912e94

Please sign in to comment.