Skip to content

Instantly share code, notes, and snippets.

@akoeplinger
Created April 25, 2017 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akoeplinger/f59dbcd1388a7a7e76c29379e02509bf to your computer and use it in GitHub Desktop.
Save akoeplinger/f59dbcd1388a7a7e76c29379e02509bf to your computer and use it in GitHub Desktop.
diff --git a/mono/mini/simd-intrinsics.c b/mono/mini/simd-intrinsics.c
index b394b545d60..846c04c550f 100644
--- a/mono/mini/simd-intrinsics.c
+++ b/mono/mini/simd-intrinsics.c
@@ -2165,6 +2165,19 @@ emit_vector_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignatu
return NULL;
}
+static MonoInst*
+emit_vector_is_hardware_accelerated_intrinsic (MonoCompile *cfg)
+{
+ MonoInst *ins;
+
+ if (simd_supported_versions)
+ EMIT_NEW_ICONST (cfg, ins, 1);
+ else
+ EMIT_NEW_ICONST (cfg, ins, 0);
+ ins->type = STACK_I4;
+ return ins;
+}
+
/* These should be ordered by name */
static const SimdIntrinsic vector_t_intrinsics[] = {
{ SN_ctor },
@@ -2447,20 +2460,9 @@ emit_sys_numerics_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodS
if (!strcmp ("Vector2", class_name) || !strcmp ("Vector4", class_name) || !strcmp ("Vector3", class_name))
return emit_vector_intrinsics (cfg, cmethod, fsig, args);
- if (!strcmp ("Vector`1", class_name))
- return emit_vector_t_intrinsics (cfg, cmethod, fsig, args);
-
if (!strcmp ("System.Numerics", nspace) && !strcmp ("Vector", class_name)) {
- if (!strcmp (cmethod->name, "get_IsHardwareAccelerated")) {
- MonoInst *ins;
-
- if (simd_supported_versions)
- EMIT_NEW_ICONST (cfg, ins, 1);
- else
- EMIT_NEW_ICONST (cfg, ins, 0);
- ins->type = STACK_I4;
- return ins;
- }
+ if (!strcmp (cmethod->name, "get_IsHardwareAccelerated"))
+ return emit_vector_is_hardware_accelerated_intrinsic (cfg);
}
return NULL;
@@ -2469,10 +2471,17 @@ emit_sys_numerics_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodS
static MonoInst*
emit_sys_numerics_vectors_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
{
+ const char *nspace = cmethod->klass->name_space;
const char *class_name = cmethod->klass->name;
if (!strcmp (class_name, "Vector`1"))
return emit_vector_t_intrinsics (cfg, cmethod, fsig, args);
+
+ if (!strcmp ("System.Numerics", nspace) && !strcmp ("Vector", class_name)) {
+ if (!strcmp (cmethod->name, "get_IsHardwareAccelerated"))
+ return emit_vector_is_hardware_accelerated_intrinsic (cfg);
+ }
+
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment