Skip to content

Commit 1ad1f65

Browse files
authored
[wasm] Add PackedSimd saturating integer arith. (#85043)
* [wasm] Add PackedSimd saturating integer arith. * Add doc comments
1 parent d4dfe98 commit 1ad1f65

File tree

6 files changed

+274
-4
lines changed

6 files changed

+274
-4
lines changed

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Wasm/PackedSimd.PlatformNotSupported.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,43 @@ public abstract class PackedSimd
123123
public static Vector128<int> AddPairwiseWidening(Vector128<short> value) { throw new PlatformNotSupportedException(); }
124124
public static Vector128<uint> AddPairwiseWidening(Vector128<ushort> value) { throw new PlatformNotSupportedException(); }
125125

126+
// Saturating integer arithmetic
127+
128+
public static Vector128<sbyte> AddSaturate(Vector128<sbyte> left, Vector128<sbyte> right) { throw new PlatformNotSupportedException(); }
129+
public static Vector128<byte> AddSaturate(Vector128<byte> left, Vector128<byte> right) { throw new PlatformNotSupportedException(); }
130+
public static Vector128<short> AddSaturate(Vector128<short> left, Vector128<short> right) { throw new PlatformNotSupportedException(); }
131+
public static Vector128<ushort> AddSaturate(Vector128<ushort> left, Vector128<ushort> right) { throw new PlatformNotSupportedException(); }
132+
133+
public static Vector128<sbyte> SubtractSaturate(Vector128<sbyte> left, Vector128<sbyte> right) { throw new PlatformNotSupportedException(); }
134+
public static Vector128<byte> SubtractSaturate(Vector128<byte> left, Vector128<byte> right) { throw new PlatformNotSupportedException(); }
135+
public static Vector128<short> SubtractSaturate(Vector128<short> left, Vector128<short> right) { throw new PlatformNotSupportedException(); }
136+
public static Vector128<ushort> SubtractSaturate(Vector128<ushort> left, Vector128<ushort> right) { throw new PlatformNotSupportedException(); }
137+
138+
public static Vector128<short> MultiplyRoundedSaturateQ15(Vector128<short> left, Vector128<short> right) { throw new PlatformNotSupportedException(); }
139+
140+
public static Vector128<sbyte> Min(Vector128<sbyte> left, Vector128<sbyte> right) { throw new PlatformNotSupportedException(); }
141+
public static Vector128<byte> Min(Vector128<byte> left, Vector128<byte> right) { throw new PlatformNotSupportedException(); }
142+
public static Vector128<short> Min(Vector128<short> left, Vector128<short> right) { throw new PlatformNotSupportedException(); }
143+
public static Vector128<ushort> Min(Vector128<ushort> left, Vector128<ushort> right) { throw new PlatformNotSupportedException(); }
144+
public static Vector128<int> Min(Vector128<int> left, Vector128<int> right) { throw new PlatformNotSupportedException(); }
145+
public static Vector128<uint> Min(Vector128<uint> left, Vector128<uint> right) { throw new PlatformNotSupportedException(); }
146+
147+
public static Vector128<sbyte> Max(Vector128<sbyte> left, Vector128<sbyte> right) { throw new PlatformNotSupportedException(); }
148+
public static Vector128<byte> Max(Vector128<byte> left, Vector128<byte> right) { throw new PlatformNotSupportedException(); }
149+
public static Vector128<short> Max(Vector128<short> left, Vector128<short> right) { throw new PlatformNotSupportedException(); }
150+
public static Vector128<ushort> Max(Vector128<ushort> left, Vector128<ushort> right) { throw new PlatformNotSupportedException(); }
151+
public static Vector128<int> Max(Vector128<int> left, Vector128<int> right) { throw new PlatformNotSupportedException(); }
152+
public static Vector128<uint> Max(Vector128<uint> left, Vector128<uint> right) { throw new PlatformNotSupportedException(); }
153+
154+
public static Vector128<byte> AverageRounded(Vector128<byte> left, Vector128<byte> right) { throw new PlatformNotSupportedException(); }
155+
public static Vector128<ushort> AverageRounded(Vector128<ushort> left, Vector128<ushort> right) { throw new PlatformNotSupportedException(); }
156+
157+
public static Vector128<sbyte> Abs(Vector128<sbyte> value) { throw new PlatformNotSupportedException(); }
158+
public static Vector128<short> Abs(Vector128<short> value) { throw new PlatformNotSupportedException(); }
159+
public static Vector128<int> Abs(Vector128<int> value) { throw new PlatformNotSupportedException(); }
160+
public static Vector128<long> Abs(Vector128<long> value) { throw new PlatformNotSupportedException(); }
161+
public static Vector128<nint> Abs(Vector128<nint> value) { throw new PlatformNotSupportedException(); }
162+
126163
// Bit shifts
127164

128165
public static Vector128<sbyte> ShiftLeft(Vector128<sbyte> value, int count) { throw new PlatformNotSupportedException(); }

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Wasm/PackedSimd.cs

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,127 @@ public abstract class PackedSimd
515515
[Intrinsic]
516516
public static Vector128<uint> AddPairwiseWidening(Vector128<ushort> value) => AddPairwiseWidening(value);
517517

518+
// Saturating integer arithmetic
519+
520+
/// <summary>
521+
/// i8x16.add.sat.s
522+
/// </summary>
523+
public static Vector128<sbyte> AddSaturate(Vector128<sbyte> left, Vector128<sbyte> right) => AddSaturate(left, right);
524+
/// <summary>
525+
/// i8x16.add.sat.u
526+
/// </summary>
527+
public static Vector128<byte> AddSaturate(Vector128<byte> left, Vector128<byte> right) => AddSaturate(left, right);
528+
/// <summary>
529+
/// i16x8.add.sat.s
530+
/// </summary>
531+
public static Vector128<short> AddSaturate(Vector128<short> left, Vector128<short> right) => AddSaturate(left, right);
532+
/// <summary>
533+
/// i16x8.add.sat.u
534+
/// </summary>
535+
public static Vector128<ushort> AddSaturate(Vector128<ushort> left, Vector128<ushort> right) => AddSaturate(left, right);
536+
537+
/// <summary>
538+
/// i8x16.sub.sat.s
539+
/// </summary>
540+
public static Vector128<sbyte> SubtractSaturate(Vector128<sbyte> left, Vector128<sbyte> right) => SubtractSaturate(left, right);
541+
/// <summary>
542+
/// i8x16.sub.sat.u
543+
/// </summary>
544+
public static Vector128<byte> SubtractSaturate(Vector128<byte> left, Vector128<byte> right) => SubtractSaturate(left, right);
545+
/// <summary>
546+
/// i16x8.sub.sat.s
547+
/// </summary>
548+
public static Vector128<short> SubtractSaturate(Vector128<short> left, Vector128<short> right) => SubtractSaturate(left, right);
549+
/// <summary>
550+
/// i16x8.sub.sat.u
551+
/// </summary>
552+
public static Vector128<ushort> SubtractSaturate(Vector128<ushort> left, Vector128<ushort> right) => SubtractSaturate(left, right);
553+
554+
/// <summary>
555+
/// i16x8.q15mulr.sat.s
556+
/// </summary>
557+
public static Vector128<short> MultiplyRoundedSaturateQ15(Vector128<short> left, Vector128<short> right) => MultiplyRoundedSaturateQ15(left, right);
558+
559+
/// <summary>
560+
/// i8x16.min.s
561+
/// </summary>
562+
public static Vector128<sbyte> Min(Vector128<sbyte> left, Vector128<sbyte> right) => Min(left, right);
563+
/// <summary>
564+
/// i8x16.min.u
565+
/// </summary>
566+
public static Vector128<byte> Min(Vector128<byte> left, Vector128<byte> right) => Min(left, right);
567+
/// <summary>
568+
/// i16x8.min.s
569+
/// </summary>
570+
public static Vector128<short> Min(Vector128<short> left, Vector128<short> right) => Min(left, right);
571+
/// <summary>
572+
/// i16x8.min.u
573+
/// </summary>
574+
public static Vector128<ushort> Min(Vector128<ushort> left, Vector128<ushort> right) => Min(left, right);
575+
/// <summary>
576+
/// i32x4.min.s
577+
/// </summary>
578+
public static Vector128<int> Min(Vector128<int> left, Vector128<int> right) => Min(left, right);
579+
/// <summary>
580+
/// i32x4.min.u
581+
/// </summary>
582+
public static Vector128<uint> Min(Vector128<uint> left, Vector128<uint> right) => Min(left, right);
583+
584+
/// <summary>
585+
/// i8x16.max.s
586+
/// </summary>
587+
public static Vector128<sbyte> Max(Vector128<sbyte> left, Vector128<sbyte> right) => Max(left, right);
588+
/// <summary>
589+
/// i8x16.max.u
590+
/// </summary>
591+
public static Vector128<byte> Max(Vector128<byte> left, Vector128<byte> right) => Max(left, right);
592+
/// <summary>
593+
/// i16x8.max.s
594+
/// </summary>
595+
public static Vector128<short> Max(Vector128<short> left, Vector128<short> right) => Max(left, right);
596+
/// <summary>
597+
/// i16x8.max.u
598+
/// </summary>
599+
public static Vector128<ushort> Max(Vector128<ushort> left, Vector128<ushort> right) => Max(left, right);
600+
/// <summary>
601+
/// i32x4.max.s
602+
/// </summary>
603+
public static Vector128<int> Max(Vector128<int> left, Vector128<int> right) => Max(left, right);
604+
/// <summary>
605+
/// i32x4.max.u
606+
/// </summary>
607+
public static Vector128<uint> Max(Vector128<uint> left, Vector128<uint> right) => Max(left, right);
608+
609+
/// <summary>
610+
/// i8x16.avgr.u
611+
/// </summary>
612+
public static Vector128<byte> AverageRounded(Vector128<byte> left, Vector128<byte> right) => AverageRounded(left, right);
613+
/// <summary>
614+
/// i16x8.avgr.u
615+
/// </summary>
616+
public static Vector128<ushort> AverageRounded(Vector128<ushort> left, Vector128<ushort> right) => AverageRounded(left, right);
617+
618+
/// <summary>
619+
/// i8x16.abs
620+
/// </summary>
621+
public static Vector128<sbyte> Abs(Vector128<sbyte> value) => Abs(value);
622+
/// <summary>
623+
/// i16x8.abs
624+
/// </summary>
625+
public static Vector128<short> Abs(Vector128<short> value) => Abs(value);
626+
/// <summary>
627+
/// i32x4.abs
628+
/// </summary>
629+
public static Vector128<int> Abs(Vector128<int> value) => Abs(value);
630+
/// <summary>
631+
/// i64x2.abs
632+
/// </summary>
633+
public static Vector128<long> Abs(Vector128<long> value) => Abs(value);
634+
/// <summary>
635+
/// i32x4.abs
636+
/// </summary>
637+
public static Vector128<nint> Abs(Vector128<nint> value) => Abs(value);
638+
518639
// Bit shifts
519640

520641
/// <summary>

src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5745,6 +5745,34 @@ public abstract partial class PackedSimd
57455745
public static Vector128<ushort> AddPairwiseWidening(Vector128<byte> value) { throw null; }
57465746
public static Vector128<int> AddPairwiseWidening(Vector128<short> value) { throw null; }
57475747
public static Vector128<uint> AddPairwiseWidening(Vector128<ushort> value) { throw null; }
5748+
public static Vector128<sbyte> AddSaturate(Vector128<sbyte> left, Vector128<sbyte> right) { throw null; }
5749+
public static Vector128<byte> AddSaturate(Vector128<byte> left, Vector128<byte> right) { throw null; }
5750+
public static Vector128<short> AddSaturate(Vector128<short> left, Vector128<short> right) { throw null; }
5751+
public static Vector128<ushort> AddSaturate(Vector128<ushort> left, Vector128<ushort> right) { throw null; }
5752+
public static Vector128<sbyte> SubtractSaturate(Vector128<sbyte> left, Vector128<sbyte> right) { throw null; }
5753+
public static Vector128<byte> SubtractSaturate(Vector128<byte> left, Vector128<byte> right) { throw null; }
5754+
public static Vector128<short> SubtractSaturate(Vector128<short> left, Vector128<short> right) { throw null; }
5755+
public static Vector128<ushort> SubtractSaturate(Vector128<ushort> left, Vector128<ushort> right) { throw null; }
5756+
public static Vector128<short> MultiplyRoundedSaturateQ15(Vector128<short> left, Vector128<short> right) { throw null; }
5757+
public static Vector128<sbyte> Min(Vector128<sbyte> left, Vector128<sbyte> right) { throw null; }
5758+
public static Vector128<byte> Min(Vector128<byte> left, Vector128<byte> right) { throw null; }
5759+
public static Vector128<short> Min(Vector128<short> left, Vector128<short> right) { throw null; }
5760+
public static Vector128<ushort> Min(Vector128<ushort> left, Vector128<ushort> right) { throw null; }
5761+
public static Vector128<int> Min(Vector128<int> left, Vector128<int> right) { throw null; }
5762+
public static Vector128<uint> Min(Vector128<uint> left, Vector128<uint> right) { throw null; }
5763+
public static Vector128<sbyte> Max(Vector128<sbyte> left, Vector128<sbyte> right) { throw null; }
5764+
public static Vector128<byte> Max(Vector128<byte> left, Vector128<byte> right) { throw null; }
5765+
public static Vector128<short> Max(Vector128<short> left, Vector128<short> right) { throw null; }
5766+
public static Vector128<ushort> Max(Vector128<ushort> left, Vector128<ushort> right) { throw null; }
5767+
public static Vector128<int> Max(Vector128<int> left, Vector128<int> right) { throw null; }
5768+
public static Vector128<uint> Max(Vector128<uint> left, Vector128<uint> right) { throw null; }
5769+
public static Vector128<byte> AverageRounded(Vector128<byte> left, Vector128<byte> right) { throw null; }
5770+
public static Vector128<ushort> AverageRounded(Vector128<ushort> left, Vector128<ushort> right) { throw null; }
5771+
public static Vector128<sbyte> Abs(Vector128<sbyte> value) { throw null; }
5772+
public static Vector128<short> Abs(Vector128<short> value) { throw null; }
5773+
public static Vector128<int> Abs(Vector128<int> value) { throw null; }
5774+
public static Vector128<long> Abs(Vector128<long> value) { throw null; }
5775+
public static Vector128<nint> Abs(Vector128<nint> value) { throw null; }
57485776
public static Vector128<sbyte> ShiftLeft(Vector128<sbyte> value, int count) { throw null; }
57495777
public static Vector128<byte> ShiftLeft(Vector128<byte> value, int count) { throw null; }
57505778
public static Vector128<short> ShiftLeft(Vector128<short> value, int count) { throw null; }

src/mono/mono/mini/llvm-intrinsics.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,18 @@ INTRINS(AESNI_AESDECLAST, x86_aesni_aesdeclast, X86)
242242
INTRINS(AESNI_AESENC, x86_aesni_aesenc, X86)
243243
INTRINS(AESNI_AESENCLAST, x86_aesni_aesenclast, X86)
244244
INTRINS(AESNI_AESIMC, x86_aesni_aesimc, X86)
245-
INTRINS_OVR(SSE_SADD_SATI8, sadd_sat, Generic, v128_i1_t)
246-
INTRINS_OVR(SSE_UADD_SATI8, uadd_sat, Generic, v128_i1_t)
247-
INTRINS_OVR(SSE_SADD_SATI16, sadd_sat, Generic, v128_i2_t)
248-
INTRINS_OVR(SSE_UADD_SATI16, uadd_sat, Generic, v128_i2_t)
249245

250246
INTRINS_OVR(SSE_SSUB_SATI8, ssub_sat, Generic, v128_i1_t)
251247
INTRINS_OVR(SSE_USUB_SATI8, usub_sat, Generic, v128_i1_t)
252248
INTRINS_OVR(SSE_SSUB_SATI16, ssub_sat, Generic, v128_i2_t)
253249
INTRINS_OVR(SSE_USUB_SATI16, usub_sat, Generic, v128_i2_t)
254250
#endif
251+
#if defined(TARGET_AMD64) || defined(TARGET_X86) || defined(TARGET_WASM)
252+
INTRINS_OVR(SSE_SADD_SATI8, sadd_sat, Generic, v128_i1_t)
253+
INTRINS_OVR(SSE_UADD_SATI8, uadd_sat, Generic, v128_i1_t)
254+
INTRINS_OVR(SSE_SADD_SATI16, sadd_sat, Generic, v128_i2_t)
255+
INTRINS_OVR(SSE_UADD_SATI16, uadd_sat, Generic, v128_i2_t)
256+
#endif
255257
#if defined(TARGET_WASM)
256258
INTRINS_OVR(WASM_EXTADD_PAIRWISE_SIGNED_V16, wasm_extadd_pairwise_signed, Wasm, sse_i2_t)
257259
INTRINS_OVR(WASM_EXTADD_PAIRWISE_SIGNED_V8, wasm_extadd_pairwise_signed, Wasm, sse_i4_t)
@@ -265,6 +267,8 @@ INTRINS_OVR(WASM_ANYTRUE_V16, wasm_anytrue, Wasm, sse_i1_t)
265267
INTRINS_OVR(WASM_ANYTRUE_V8, wasm_anytrue, Wasm, sse_i2_t)
266268
INTRINS_OVR(WASM_ANYTRUE_V4, wasm_anytrue, Wasm, sse_i4_t)
267269
INTRINS_OVR(WASM_ANYTRUE_V2, wasm_anytrue, Wasm, sse_i8_t)
270+
INTRINS_OVR(WASM_AVERAGE_ROUNDED_V16, wasm_avgr_unsigned, Wasm, sse_i1_t)
271+
INTRINS_OVR(WASM_AVERAGE_ROUNDED_V8, wasm_avgr_unsigned, Wasm, sse_i2_t)
268272
INTRINS_OVR(WASM_BITMASK_V16, wasm_bitmask, Wasm, sse_i1_t)
269273
INTRINS_OVR(WASM_BITMASK_V8, wasm_bitmask, Wasm, sse_i2_t)
270274
INTRINS_OVR(WASM_BITMASK_V4, wasm_bitmask, Wasm, sse_i4_t)
@@ -276,7 +280,12 @@ INTRINS_OVR_2_ARG(WASM_NARROW_SIGNED_V16, wasm_narrow_signed, Wasm, sse_i1_t, ss
276280
INTRINS_OVR_2_ARG(WASM_NARROW_SIGNED_V8, wasm_narrow_signed, Wasm, sse_i2_t, sse_i4_t)
277281
INTRINS_OVR_2_ARG(WASM_NARROW_UNSIGNED_V16, wasm_narrow_unsigned, Wasm, sse_i1_t, sse_i2_t)
278282
INTRINS_OVR_2_ARG(WASM_NARROW_UNSIGNED_V8, wasm_narrow_unsigned, Wasm, sse_i2_t, sse_i4_t)
283+
INTRINS(WASM_Q15MULR_SAT_SIGNED, wasm_q15mulr_sat_signed, Wasm)
279284
INTRINS(WASM_SHUFFLE, wasm_shuffle, Wasm)
285+
INTRINS_OVR(WASM_SUB_SAT_SIGNED_V16, wasm_sub_sat_signed, Wasm, sse_i1_t)
286+
INTRINS_OVR(WASM_SUB_SAT_SIGNED_V8, wasm_sub_sat_signed, Wasm, sse_i2_t)
287+
INTRINS_OVR(WASM_SUB_SAT_UNSIGNED_V16, wasm_sub_sat_unsigned, Wasm, sse_i1_t)
288+
INTRINS_OVR(WASM_SUB_SAT_UNSIGNED_V8, wasm_sub_sat_unsigned, Wasm, sse_i2_t)
280289
INTRINS(WASM_SWIZZLE, wasm_swizzle, Wasm)
281290
#endif
282291
#if defined(TARGET_ARM64)

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

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4961,17 +4961,23 @@ static SimdIntrinsic wasmbase_methods [] = {
49614961
};
49624962

49634963
static SimdIntrinsic packedsimd_methods [] = {
4964+
{SN_Abs, OP_VECTOR_IABS},
49644965
{SN_Add},
49654966
{SN_AddPairwiseWidening},
4967+
{SN_AddSaturate},
49664968
{SN_And, OP_XBINOP_FORCEINT, XBINOP_FORCEINT_AND},
4969+
{SN_AverageRounded},
49674970
{SN_Bitmask, OP_WASM_SIMD_BITMASK},
49684971
{SN_CompareEqual},
49694972
{SN_CompareNotEqual},
49704973
{SN_ConvertNarrowingSignedSaturate},
49714974
{SN_ConvertNarrowingUnsignedSaturate},
49724975
{SN_Dot, OP_XOP_X_X_X, INTRINS_WASM_DOT},
49734976
{SN_ExtractLane},
4977+
{SN_Max, OP_XBINOP, OP_IMIN, OP_XBINOP, OP_IMIN_UN},
4978+
{SN_Min, OP_XBINOP, OP_IMAX, OP_XBINOP, OP_IMAX_UN},
49744979
{SN_Multiply},
4980+
{SN_MultiplyRoundedSaturateQ15, OP_XOP_X_X_X, INTRINS_WASM_Q15MULR_SAT_SIGNED},
49754981
{SN_MultiplyWideningLower, OP_WASM_EXTMUL_LOWER, 0, OP_WASM_EXTMUL_LOWER_U},
49764982
{SN_MultiplyWideningUpper, OP_WASM_EXTMUL_UPPER, 0, OP_WASM_EXTMUL_UPPER_U},
49774983
{SN_Negate},
@@ -4982,6 +4988,7 @@ static SimdIntrinsic packedsimd_methods [] = {
49824988
{SN_Shuffle, OP_WASM_SIMD_SHUFFLE},
49834989
{SN_Splat},
49844990
{SN_Subtract},
4991+
{SN_SubtractSaturate},
49854992
{SN_Swizzle, OP_WASM_SIMD_SWIZZLE},
49864993
{SN_get_IsSupported},
49874994
};
@@ -5088,6 +5095,48 @@ emit_wasm_supported_intrinsics (
50885095

50895096
return NULL;
50905097
}
5098+
case SN_AddSaturate: {
5099+
op = OP_XOP_X_X_X;
5100+
5101+
switch (arg0_type) {
5102+
case MONO_TYPE_I1:
5103+
c0 = INTRINS_SSE_SADD_SATI8;
5104+
break;
5105+
case MONO_TYPE_I2:
5106+
c0 = INTRINS_SSE_SADD_SATI16;
5107+
break;
5108+
case MONO_TYPE_U1:
5109+
c0 = INTRINS_SSE_UADD_SATI8;
5110+
break;
5111+
case MONO_TYPE_U2:
5112+
c0 = INTRINS_SSE_UADD_SATI16;
5113+
break;
5114+
}
5115+
5116+
// continue with default emit
5117+
if (c0 != 0)
5118+
break;
5119+
5120+
return NULL;
5121+
}
5122+
case SN_AverageRounded: {
5123+
op = OP_XOP_X_X_X;
5124+
5125+
switch (arg0_type) {
5126+
case MONO_TYPE_U1:
5127+
c0 = INTRINS_WASM_AVERAGE_ROUNDED_V16;
5128+
break;
5129+
case MONO_TYPE_U2:
5130+
c0 = INTRINS_WASM_AVERAGE_ROUNDED_V8;
5131+
break;
5132+
}
5133+
5134+
// continue with default emit
5135+
if (c0 != 0)
5136+
break;
5137+
5138+
return NULL;
5139+
}
50915140
case SN_CompareEqual:
50925141
return emit_simd_ins_for_sig (cfg, klass, type_enum_is_float (arg0_type) ? OP_XCOMPARE_FP : OP_XCOMPARE, CMP_EQ, arg0_type, fsig, args);
50935142
case SN_CompareNotEqual:
@@ -5144,6 +5193,30 @@ emit_wasm_supported_intrinsics (
51445193
g_assert (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype));
51455194
return emit_simd_ins (cfg, klass, type_to_expand_op (etype->type), args [0]->dreg, -1);
51465195
}
5196+
case SN_SubtractSaturate: {
5197+
op = OP_XOP_X_X_X;
5198+
5199+
switch (arg0_type) {
5200+
case MONO_TYPE_I1:
5201+
c0 = INTRINS_WASM_SUB_SAT_SIGNED_V16;
5202+
break;
5203+
case MONO_TYPE_I2:
5204+
c0 = INTRINS_WASM_SUB_SAT_SIGNED_V8;
5205+
break;
5206+
case MONO_TYPE_U1:
5207+
c0 = INTRINS_WASM_SUB_SAT_UNSIGNED_V16;
5208+
break;
5209+
case MONO_TYPE_U2:
5210+
c0 = INTRINS_WASM_SUB_SAT_UNSIGNED_V8;
5211+
break;
5212+
}
5213+
5214+
// continue with default emit
5215+
if (c0 != 0)
5216+
break;
5217+
5218+
return NULL;
5219+
}
51475220
}
51485221

51495222
// default emit path for cases with op set

src/mono/mono/mini/simd-methods.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,12 @@ METHOD(MultiplyRoundedDoublingScalarBySelectedScalarAndSubtractSaturateHigh)
634634
// Arm.Dp
635635
METHOD(DotProductBySelectedQuadruplet)
636636
// Wasm
637+
METHOD(AverageRounded)
637638
METHOD(Bitmask)
638639
METHOD(ConvertNarrowingSignedSaturate)
639640
METHOD(ConvertNarrowingUnsignedSaturate)
640641
METHOD(ExtractLane)
642+
METHOD(MultiplyRoundedSaturateQ15)
641643
METHOD(ReplaceLane)
642644
METHOD(ShiftLeft)
643645
METHOD(Splat)

0 commit comments

Comments
 (0)