Skip to content

Commit 2cfc0cd

Browse files
authored
[wasm] Speedup Vector128.Shuffle with SIMD (#74872)
Example speedup result in Span.Reverse Firefox/amd64 | measurement | before | after | delta | |-:|-:|-:|-:| | Span, Reverse bytes | 0.0857ms | 0.0022ms | 39x faster | | Span, Reverse chars | 0.0987ms | 0.0042ms | 23.5x faster| Chrome/amd64 | measurement | before | after | delta | |-:|-:|-:|-:| | Span, Reverse bytes | 0.0768ms | 0.0028ms | 27.4x faster | | Span, Reverse chars | 0.0975ms | 0.0061ms | 16x faster |
1 parent c8009fe commit 2cfc0cd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ static guint16 sri_vector_methods [] = {
937937
SN_Narrow,
938938
SN_Negate,
939939
SN_OnesComplement,
940+
SN_Shuffle,
940941
SN_Sqrt,
941942
SN_Subtract,
942943
SN_Sum,
@@ -1370,6 +1371,15 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
13701371
return NULL;
13711372
return emit_simd_ins_for_unary_op (cfg, klass, fsig, args, arg0_type, id);
13721373
}
1374+
case SN_Shuffle: {
1375+
if (!is_element_type_primitive (fsig->params [0]))
1376+
return NULL;
1377+
#ifdef TARGET_WASM
1378+
return emit_simd_ins_for_sig (cfg, klass, OP_WASM_SIMD_SWIZZLE, -1, -1, fsig, args);
1379+
#else
1380+
return NULL;
1381+
#endif
1382+
}
13731383
case SN_Sum: {
13741384
#ifdef TARGET_ARM64
13751385
if (!is_element_type_primitive (fsig->params [0]))

0 commit comments

Comments
 (0)