Skip to content

Commit b33aede

Browse files
authored
[wasm] Enable System.Numerics vectors SIMD (#78068)
This helps in cases where there's only S.N.Vector path in the BCL code, like `SpanHelpers.IndexOfChar(ref char searchSpace, char value, int length)`. In this case the `Span:IndexOf char` measurement improves from 0.0143ms to 0.0114ms. * [wasm] Enable System.Numerics vectors SIMD * Do not hardcode S.N.Vector IsHardwareAccelerated
1 parent fdd1f63 commit b33aede

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/mono/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.wasm.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<linker>
22
<assembly fullname="System.Private.CoreLib">
3-
<type fullname="System.Numerics.Vector">
4-
<method signature="System.Boolean get_IsHardwareAccelerated()" body="stub" value="false" />
5-
</type>
63
<type fullname="System.Environment">
74
<method signature="System.Int32 get_ProcessorCount()" body="stub" value="1" />
85
</type>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4534,6 +4534,20 @@ arch_emit_simd_intrinsics (const char *class_ns, const char *class_name, MonoCom
45344534
return emit_vector64_vector128_t (cfg, cmethod, fsig, args);
45354535
}
45364536

4537+
if (!strcmp (class_ns, "System.Numerics") && !strcmp (class_name, "Vector")){
4538+
return emit_sri_vector (cfg, cmethod, fsig, args);
4539+
}
4540+
4541+
if (!strcmp (class_ns, "System.Numerics") && !strcmp (class_name, "Vector`1")){
4542+
return emit_vector64_vector128_t (cfg, cmethod, fsig, args);
4543+
}
4544+
4545+
if (!strcmp (class_ns, "System.Numerics")) {
4546+
//if (!strcmp ("Vector2", class_name) || !strcmp ("Vector4", class_name) || !strcmp ("Vector3", class_name))
4547+
if (!strcmp ("Vector4", class_name))
4548+
return emit_vector_2_3_4 (cfg, cmethod, fsig, args);
4549+
}
4550+
45374551
return NULL;
45384552
}
45394553
#else

0 commit comments

Comments
 (0)