@@ -1864,11 +1864,11 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
1864
1864
int op = id == SN_WidenLower ? OP_XLOWER : OP_XUPPER ;
1865
1865
MonoInst * lower_or_upper_half = emit_simd_ins_for_sig (cfg , klass , op , 0 , arg0_type , fsig , args );
1866
1866
if (type_enum_is_float (arg0_type )) {
1867
- return emit_simd_ins (cfg , klass , OP_FCVTL , lower_or_upper_half -> dreg , -1 );
1867
+ return emit_simd_ins (cfg , klass , OP_SIMD_FCVTL , lower_or_upper_half -> dreg , -1 );
1868
1868
} else {
1869
1869
int zero = alloc_ireg (cfg );
1870
1870
MONO_EMIT_NEW_ICONST (cfg , zero , 0 );
1871
- op = type_enum_is_unsigned (arg0_type ) ? OP_USHLL : OP_SSHLL ;
1871
+ op = type_enum_is_unsigned (arg0_type ) ? OP_SIMD_USHLL : OP_SIMD_SSHLL ;
1872
1872
return emit_simd_ins (cfg , klass , op , lower_or_upper_half -> dreg , zero );
1873
1873
}
1874
1874
#else
@@ -2932,9 +2932,9 @@ static SimdIntrinsic advsimd_methods [] = {
2932
2932
{SN_CompareLessThanScalar , OP_XCOMPARE_SCALAR , CMP_LT , OP_XCOMPARE_SCALAR , CMP_LT_UN , OP_XCOMPARE_FP_SCALAR , CMP_LT },
2933
2933
{SN_CompareTest , OP_ARM64_CMTST },
2934
2934
{SN_CompareTestScalar , OP_ARM64_CMTST },
2935
- {SN_ConvertToDouble , OP_CVT_SI_FP , None , OP_CVT_UI_FP , None , OP_FCVTL },
2935
+ {SN_ConvertToDouble , OP_CVT_SI_FP , None , OP_CVT_UI_FP , None , OP_SIMD_FCVTL },
2936
2936
{SN_ConvertToDoubleScalar , OP_CVT_SI_FP_SCALAR , None , OP_CVT_UI_FP_SCALAR },
2937
- {SN_ConvertToDoubleUpper , OP_FCVTL2 },
2937
+ {SN_ConvertToDoubleUpper , OP_SIMD_FCVTL2 },
2938
2938
{SN_ConvertToInt32RoundAwayFromZero , OP_XOP_OVR_X_X , INTRINS_AARCH64_ADV_SIMD_FCVTAS },
2939
2939
{SN_ConvertToInt32RoundAwayFromZeroScalar , OP_XOP_OVR_SCALAR_X_X , INTRINS_AARCH64_ADV_SIMD_FCVTAS },
2940
2940
{SN_ConvertToInt32RoundToEven , OP_XOP_OVR_X_X , INTRINS_AARCH64_ADV_SIMD_FCVTNS },
@@ -3166,14 +3166,14 @@ static SimdIntrinsic advsimd_methods [] = {
3166
3166
{SN_ShiftArithmeticScalar , OP_XOP_OVR_X_X_X , INTRINS_AARCH64_ADV_SIMD_SSHL },
3167
3167
{SN_ShiftLeftAndInsert , OP_ARM64_SLI },
3168
3168
{SN_ShiftLeftAndInsertScalar , OP_ARM64_SLI },
3169
- {SN_ShiftLeftLogical , OP_SHL },
3169
+ {SN_ShiftLeftLogical , OP_SIMD_SHL },
3170
3170
{SN_ShiftLeftLogicalSaturate },
3171
3171
{SN_ShiftLeftLogicalSaturateScalar },
3172
3172
{SN_ShiftLeftLogicalSaturateUnsigned , OP_ARM64_SQSHLU },
3173
3173
{SN_ShiftLeftLogicalSaturateUnsignedScalar , OP_ARM64_SQSHLU_SCALAR },
3174
- {SN_ShiftLeftLogicalScalar , OP_SHL },
3175
- {SN_ShiftLeftLogicalWideningLower , OP_SSHLL , None , OP_USHLL },
3176
- {SN_ShiftLeftLogicalWideningUpper , OP_SSHLL2 , None , OP_USHLL2 },
3174
+ {SN_ShiftLeftLogicalScalar , OP_SIMD_SHL },
3175
+ {SN_ShiftLeftLogicalWideningLower , OP_SIMD_SSHLL , None , OP_SIMD_USHLL },
3176
+ {SN_ShiftLeftLogicalWideningUpper , OP_SIMD_SSHLL2 , None , OP_SIMD_USHLL2 },
3177
3177
{SN_ShiftLogical , OP_XOP_OVR_X_X_X , INTRINS_AARCH64_ADV_SIMD_USHL },
3178
3178
{SN_ShiftLogicalRounded , OP_XOP_OVR_X_X_X , INTRINS_AARCH64_ADV_SIMD_URSHL },
3179
3179
{SN_ShiftLogicalRoundedSaturate , OP_XOP_OVR_X_X_X , INTRINS_AARCH64_ADV_SIMD_UQRSHL },
@@ -3184,9 +3184,9 @@ static SimdIntrinsic advsimd_methods [] = {
3184
3184
{SN_ShiftLogicalScalar , OP_XOP_OVR_X_X_X , INTRINS_AARCH64_ADV_SIMD_USHL },
3185
3185
{SN_ShiftRightAndInsert , OP_ARM64_SRI },
3186
3186
{SN_ShiftRightAndInsertScalar , OP_ARM64_SRI },
3187
- {SN_ShiftRightArithmetic , OP_SSHR },
3188
- {SN_ShiftRightArithmeticAdd , OP_SSRA },
3189
- {SN_ShiftRightArithmeticAddScalar , OP_SSRA },
3187
+ {SN_ShiftRightArithmetic , OP_SIMD_SSHR },
3188
+ {SN_ShiftRightArithmeticAdd , OP_SIMD_SSRA },
3189
+ {SN_ShiftRightArithmeticAddScalar , OP_SIMD_SSRA },
3190
3190
{SN_ShiftRightArithmeticNarrowingSaturateLower , OP_ARM64_XNSHIFT , INTRINS_AARCH64_ADV_SIMD_SQSHRN },
3191
3191
{SN_ShiftRightArithmeticNarrowingSaturateScalar , OP_ARM64_XNSHIFT_SCALAR , INTRINS_AARCH64_ADV_SIMD_SQSHRN },
3192
3192
{SN_ShiftRightArithmeticNarrowingSaturateUnsignedLower , OP_ARM64_XNSHIFT , INTRINS_AARCH64_ADV_SIMD_SQSHRUN },
@@ -3203,10 +3203,10 @@ static SimdIntrinsic advsimd_methods [] = {
3203
3203
{SN_ShiftRightArithmeticRoundedNarrowingSaturateUnsignedUpper , OP_ARM64_XNSHIFT2 , INTRINS_AARCH64_ADV_SIMD_SQRSHRUN },
3204
3204
{SN_ShiftRightArithmeticRoundedNarrowingSaturateUpper , OP_ARM64_XNSHIFT2 , INTRINS_AARCH64_ADV_SIMD_SQRSHRN },
3205
3205
{SN_ShiftRightArithmeticRoundedScalar , OP_ARM64_SRSHR },
3206
- {SN_ShiftRightArithmeticScalar , OP_SSHR },
3207
- {SN_ShiftRightLogical , OP_USHR },
3208
- {SN_ShiftRightLogicalAdd , OP_USRA },
3209
- {SN_ShiftRightLogicalAddScalar , OP_USRA },
3206
+ {SN_ShiftRightArithmeticScalar , OP_SIMD_SSHR },
3207
+ {SN_ShiftRightLogical , OP_SIMD_USHR },
3208
+ {SN_ShiftRightLogicalAdd , OP_SIMD_USRA },
3209
+ {SN_ShiftRightLogicalAddScalar , OP_SIMD_USRA },
3210
3210
{SN_ShiftRightLogicalNarrowingLower , OP_ARM64_SHRN },
3211
3211
{SN_ShiftRightLogicalNarrowingSaturateLower , OP_ARM64_XNSHIFT , INTRINS_AARCH64_ADV_SIMD_UQSHRN },
3212
3212
{SN_ShiftRightLogicalNarrowingSaturateScalar , OP_ARM64_XNSHIFT_SCALAR , INTRINS_AARCH64_ADV_SIMD_UQSHRN },
@@ -3221,7 +3221,7 @@ static SimdIntrinsic advsimd_methods [] = {
3221
3221
{SN_ShiftRightLogicalRoundedNarrowingSaturateUpper , OP_ARM64_XNSHIFT2 , INTRINS_AARCH64_ADV_SIMD_UQRSHRN },
3222
3222
{SN_ShiftRightLogicalRoundedNarrowingUpper , OP_ARM64_XNSHIFT2 , INTRINS_AARCH64_ADV_SIMD_RSHRN },
3223
3223
{SN_ShiftRightLogicalRoundedScalar , OP_ARM64_URSHR },
3224
- {SN_ShiftRightLogicalScalar , OP_USHR },
3224
+ {SN_ShiftRightLogicalScalar , OP_SIMD_USHR },
3225
3225
{SN_SignExtendWideningLower , OP_ARM64_SXTL },
3226
3226
{SN_SignExtendWideningUpper , OP_ARM64_SXTL2 },
3227
3227
{SN_Sqrt , OP_XOP_OVR_X_X , INTRINS_AARCH64_ADV_SIMD_FSQRT },
@@ -4750,24 +4750,24 @@ static SimdIntrinsic wasmbase_methods [] = {
4750
4750
4751
4751
static SimdIntrinsic packedsimd_methods [] = {
4752
4752
{SN_Add },
4753
- {SN_And },
4754
- {SN_Bitmask },
4753
+ {SN_And , OP_XBINOP_FORCEINT , XBINOP_FORCEINT_AND },
4754
+ {SN_Bitmask , OP_WASM_SIMD_BITMASK },
4755
4755
{SN_CompareEqual },
4756
4756
{SN_CompareNotEqual },
4757
4757
{SN_ConvertNarrowingSignedSaturate },
4758
4758
{SN_ConvertNarrowingUnsignedSaturate },
4759
- {SN_Dot },
4759
+ {SN_Dot , OP_XOP_X_X_X , INTRINS_WASM_DOT },
4760
4760
{SN_ExtractLane },
4761
4761
{SN_Multiply },
4762
4762
{SN_Negate },
4763
4763
{SN_ReplaceLane },
4764
- {SN_ShiftLeft },
4765
- {SN_ShiftRightArithmetic },
4766
- {SN_ShiftRightLogical },
4767
- {SN_Shuffle },
4764
+ {SN_ShiftLeft , OP_SIMD_SHL },
4765
+ {SN_ShiftRightArithmetic , OP_SIMD_SSHR },
4766
+ {SN_ShiftRightLogical , OP_SIMD_USHR },
4767
+ {SN_Shuffle , OP_WASM_SIMD_SHUFFLE },
4768
4768
{SN_Splat },
4769
4769
{SN_Subtract },
4770
- {SN_Swizzle },
4770
+ {SN_Swizzle , OP_WASM_SIMD_SWIZZLE },
4771
4771
{SN_get_IsSupported },
4772
4772
};
4773
4773
@@ -4839,54 +4839,59 @@ emit_wasm_supported_intrinsics (
4839
4839
id == SN_Splat && !MONO_TYPE_IS_VECTOR_PRIMITIVE (fsig -> params [0 ]))
4840
4840
return NULL ;
4841
4841
4842
+ uint16_t op = info -> default_op ;
4843
+ uint16_t c0 = info -> default_instc0 ;
4844
+
4842
4845
switch (id ) {
4843
4846
case SN_Add :
4844
4847
case SN_Subtract :
4845
4848
case SN_Multiply :
4846
4849
return emit_simd_ins_for_binary_op (cfg , klass , fsig , args , arg0_type , id );
4847
4850
case SN_Negate :
4848
4851
return emit_simd_ins_for_unary_op (cfg , klass , fsig , args , arg0_type , id );
4849
- case SN_And :
4850
- return emit_simd_ins_for_sig (cfg , klass , OP_XBINOP_FORCEINT , XBINOP_FORCEINT_AND , arg0_type , fsig , args );
4851
- case SN_Bitmask :
4852
- return emit_simd_ins_for_sig (cfg , klass , OP_WASM_SIMD_BITMASK , -1 , -1 , fsig , args );
4853
4852
case SN_CompareEqual :
4854
4853
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 );
4855
4854
case SN_CompareNotEqual :
4856
4855
return emit_simd_ins_for_sig (cfg , klass , type_enum_is_float (arg0_type ) ? OP_XCOMPARE_FP : OP_XCOMPARE , CMP_NE , arg0_type , fsig , args );
4857
4856
case SN_ConvertNarrowingSignedSaturate : {
4858
- int intrins = -1 ;
4857
+ op = OP_XOP_X_X_X ;
4858
+
4859
4859
switch (arg0_type ) {
4860
4860
case MONO_TYPE_I2 :
4861
- intrins = INTRINS_WASM_NARROW_SIGNED_V16 ;
4861
+ c0 = INTRINS_WASM_NARROW_SIGNED_V16 ;
4862
4862
break ;
4863
4863
case MONO_TYPE_I4 :
4864
- intrins = INTRINS_WASM_NARROW_SIGNED_V8 ;
4864
+ c0 = INTRINS_WASM_NARROW_SIGNED_V8 ;
4865
4865
break ;
4866
4866
}
4867
- if (intrins != -1 )
4868
- return emit_simd_ins_for_sig (cfg , klass , OP_XOP_X_X_X , intrins , arg0_type , fsig , args );
4867
+
4868
+ // continue with default emit
4869
+ if (c0 != 0 )
4870
+ break ;
4869
4871
4870
4872
return NULL ;
4871
4873
}
4872
4874
case SN_ConvertNarrowingUnsignedSaturate : {
4873
- int intrins = -1 ;
4875
+ op = OP_XOP_X_X_X ;
4876
+
4874
4877
switch (arg0_type ) {
4875
4878
case MONO_TYPE_I2 :
4876
- intrins = INTRINS_WASM_NARROW_UNSIGNED_V16 ;
4879
+ c0 = INTRINS_WASM_NARROW_UNSIGNED_V16 ;
4877
4880
break ;
4878
4881
case MONO_TYPE_I4 :
4879
- intrins = INTRINS_WASM_NARROW_UNSIGNED_V8 ;
4882
+ c0 = INTRINS_WASM_NARROW_UNSIGNED_V8 ;
4880
4883
break ;
4881
4884
}
4882
- if (intrins != -1 )
4883
- return emit_simd_ins_for_sig (cfg , klass , OP_XOP_X_X_X , intrins , arg0_type , fsig , args );
4885
+
4886
+ // continue with default emit
4887
+ if (c0 != 0 )
4888
+ break ;
4884
4889
4885
4890
return NULL ;
4886
4891
}
4887
4892
case SN_ExtractLane : {
4888
- int extract_op = type_to_xextract_op (arg0_type );
4889
- return emit_simd_ins_for_sig ( cfg , klass , extract_op , -1 , arg0_type , fsig , args ) ;
4893
+ op = type_to_xextract_op (arg0_type );
4894
+ break ;
4890
4895
}
4891
4896
case SN_ReplaceLane : {
4892
4897
int insert_op = type_to_xinsert_op (arg0_type );
@@ -4895,25 +4900,18 @@ emit_wasm_supported_intrinsics (
4895
4900
ins -> inst_c1 = arg0_type ;
4896
4901
return ins ;
4897
4902
}
4898
- case SN_ShiftLeft :
4899
- return emit_simd_ins_for_sig (cfg , klass , OP_SHL , -1 , -1 , fsig , args );
4900
- case SN_ShiftRightArithmetic :
4901
- return emit_simd_ins_for_sig (cfg , klass , OP_SSHR , -1 , -1 , fsig , args );
4902
- case SN_ShiftRightLogical :
4903
- return emit_simd_ins_for_sig (cfg , klass , OP_USHR , -1 , -1 , fsig , args );
4904
4903
case SN_Splat : {
4905
4904
MonoType * etype = get_vector_t_elem_type (fsig -> ret );
4906
4905
g_assert (fsig -> param_count == 1 && mono_metadata_type_equal (fsig -> params [0 ], etype ));
4907
4906
return emit_simd_ins (cfg , klass , type_to_expand_op (etype -> type ), args [0 ]-> dreg , -1 );
4908
4907
}
4909
- case SN_Dot :
4910
- return emit_simd_ins_for_sig (cfg , klass , OP_XOP_X_X_X , INTRINS_WASM_DOT , -1 , fsig , args );
4911
- case SN_Shuffle :
4912
- return emit_simd_ins_for_sig (cfg , klass , OP_WASM_SIMD_SHUFFLE , -1 , -1 , fsig , args );
4913
- case SN_Swizzle :
4914
- return emit_simd_ins_for_sig (cfg , klass , OP_WASM_SIMD_SWIZZLE , -1 , -1 , fsig , args );
4915
4908
}
4909
+
4910
+ // default emit path for cases with op set
4911
+ if (op != 0 )
4912
+ return emit_simd_ins_for_sig (cfg , klass , op , c0 , arg0_type , fsig , args );
4916
4913
}
4914
+
4917
4915
g_assert_not_reached ();
4918
4916
4919
4917
return NULL ;
0 commit comments