[runtime] Implement the many argument version of the Vector128.Create () intrinsic...
authorZoltan Varga <vargaz@gmail.com>
Thu, 28 May 2020 16:07:01 +0000 (12:07 -0400)
committerGitHub <noreply@github.com>
Thu, 28 May 2020 16:07:01 +0000 (12:07 -0400)
src/mono/mono/mini/simd-intrinsics-netcore.c

index 50f904b..688c362 100644 (file)
@@ -1916,8 +1916,23 @@ emit_vector128 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig
                if (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype)) {
                        return emit_simd_ins (cfg, klass, type_to_expand_op (etype), args [0]->dreg, -1);
                } else {
-                       // TODO: Optimize Create(a1, a2, a3 ...) overloads
-                       break;
+                       MonoInst *ins, *load;
+
+                       // FIXME: Optimize this
+                       MONO_INST_NEW (cfg, ins, OP_LOCALLOC_IMM);
+                       ins->dreg = alloc_preg (cfg);
+                       ins->inst_imm = 16;
+                       MONO_ADD_INS (cfg->cbb, ins);
+
+                       int esize = mono_class_value_size (mono_class_from_mono_type_internal (etype), NULL);
+                       int store_opcode = mono_type_to_store_membase (cfg, etype);
+                       for (int i = 0; i < fsig->param_count; ++i)
+                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, store_opcode, ins->dreg, i * esize, args [i]->dreg);
+
+                       load = emit_simd_ins (cfg, klass, OP_SSE_LOADU, ins->dreg, -1);
+                       load->inst_c0 = 16;
+                       load->inst_c1 = get_underlying_type (etype);
+                       return load;
                }
        }
        case SN_CreateScalarUnsafe: