@@ -1845,7 +1845,7 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
1845
1845
arg_class = mono_class_from_mono_type_internal (fsig -> params [0 ]);
1846
1846
}
1847
1847
1848
- // FIXME: Add support for Vector64 on arm64
1848
+ // FIXME: Add support for Vector64 on arm64 https://github.com/dotnet/runtime/issues/90402
1849
1849
int size = mono_class_value_size (arg_class , NULL );
1850
1850
if (size != 16 )
1851
1851
return NULL ;
@@ -2608,7 +2608,7 @@ emit_vector64_vector128_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
2608
2608
}
2609
2609
2610
2610
// System.Numerics.Vector2/Vector3/Vector4, Quaternion, and Plane
2611
- static guint16 vector2_methods [] = {
2611
+ static guint16 vector_2_3_4_methods [] = {
2612
2612
SN_ctor ,
2613
2613
SN_Abs ,
2614
2614
SN_Add ,
@@ -2651,12 +2651,12 @@ static G_GNUC_UNUSED MonoInst*
2651
2651
emit_vector_2_3_4 (MonoCompile * cfg , MonoMethod * cmethod , MonoMethodSignature * fsig , MonoInst * * args )
2652
2652
{
2653
2653
MonoInst * ins ;
2654
- int id ;
2654
+ int id , len ;
2655
2655
MonoClass * klass ;
2656
2656
MonoType * type , * etype ;
2657
2657
2658
2658
2659
- id = lookup_intrins (vector2_methods , sizeof (vector2_methods ), cmethod );
2659
+ id = lookup_intrins (vector_2_3_4_methods , sizeof (vector_2_3_4_methods ), cmethod );
2660
2660
if (id == -1 ) {
2661
2661
// https://github.com/dotnet/runtime/issues/81961
2662
2662
// check_no_intrinsic_cattr (cmethod);
@@ -2677,6 +2677,7 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2677
2677
klass = cmethod -> klass ;
2678
2678
type = m_class_get_byval_arg (klass );
2679
2679
etype = m_class_get_byval_arg (mono_defaults .single_class );
2680
+ len = mono_class_value_size (klass , NULL ) / 4 ;
2680
2681
2681
2682
// Similar to the cases in emit_sys_numerics_vector_t ()
2682
2683
switch (id ) {
@@ -2706,7 +2707,6 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2706
2707
}
2707
2708
// FIXME: These don't work since Vector2/Vector3 are not handled as SIMD
2708
2709
#if 0
2709
- int len = mono_class_value_size (klass , NULL ) / 4 ;
2710
2710
} else if (len == 3 && fsig -> param_count == 2 && fsig -> params [0 ]-> type == MONO_TYPE_VALUETYPE && fsig -> params [1 ]-> type == etype -> type ) {
2711
2711
/* Vector3 (Vector2, float) */
2712
2712
int dreg = load_simd_vreg (cfg , cmethod , args [0 ], NULL );
@@ -2739,26 +2739,25 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2739
2739
case SN_get_Item : {
2740
2740
// GetElement is marked as Intrinsic, but handling this in get_Item leads to better code
2741
2741
int src1 = load_simd_vreg (cfg , cmethod , args [0 ], NULL );
2742
- int elems = 4 ;
2743
2742
MonoTypeEnum ty = etype -> type ;
2744
2743
2745
2744
if (args [1 ]-> opcode == OP_ICONST ) {
2746
2745
// If the index is provably a constant, we can generate vastly better code.
2747
2746
int index = GTMREG_TO_INT (args [1 ]-> inst_c0 );
2748
2747
2749
- if (index < 0 || index >= elems ) {
2750
- MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , elems );
2748
+ if (index < 0 || index >= len ) {
2749
+ MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , len );
2751
2750
MONO_EMIT_NEW_COND_EXC (cfg , GE_UN , "ArgumentOutOfRangeException" );
2752
2751
}
2753
2752
2754
2753
int opcode = type_to_extract_op (ty );
2755
2754
ins = emit_simd_ins (cfg , klass , opcode , src1 , -1 );
2756
- ins -> inst_c0 = args [ 1 ] -> inst_c0 ;
2755
+ ins -> inst_c0 = index ;
2757
2756
ins -> inst_c1 = ty ;
2758
2757
return ins ;
2759
2758
}
2760
2759
2761
- MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , elems );
2760
+ MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , len );
2762
2761
MONO_EMIT_NEW_COND_EXC (cfg , GE_UN , "ArgumentOutOfRangeException" );
2763
2762
2764
2763
if (COMPILE_LLVM (cfg )) {
@@ -2826,14 +2825,14 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2826
2825
g_assert (fsig -> hasthis && fsig -> param_count == 2 && fsig -> params [0 ]-> type == MONO_TYPE_I4 && fsig -> params [1 ]-> type == MONO_TYPE_R4 );
2827
2826
2828
2827
gboolean indirect = FALSE;
2829
- int elems = 4 , index = GTMREG_TO_INT (args [1 ]-> inst_c0 );
2828
+ int index = GTMREG_TO_INT (args [1 ]-> inst_c0 );
2830
2829
int dreg = load_simd_vreg (cfg , cmethod , args [0 ], & indirect );
2831
2830
2832
2831
if (args [1 ]-> opcode == OP_ICONST ) {
2833
2832
// If the index is provably a constant, we can generate vastly better code.
2834
2833
// Bounds check only if the index is out of range
2835
- if (index < 0 || index >= elems ) {
2836
- MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , elems );
2834
+ if (index < 0 || index >= len ) {
2835
+ MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , len );
2837
2836
MONO_EMIT_NEW_COND_EXC (cfg , GE_UN , "ArgumentOutOfRangeException" );
2838
2837
}
2839
2838
@@ -2850,7 +2849,7 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2850
2849
return ins ;
2851
2850
}
2852
2851
2853
- MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , elems );
2852
+ MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , args [1 ]-> dreg , len );
2854
2853
MONO_EMIT_NEW_COND_EXC (cfg , GE_UN , "ArgumentOutOfRangeException" );
2855
2854
2856
2855
if (COMPILE_LLVM (cfg )) {
@@ -2968,7 +2967,7 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2968
2967
#endif
2969
2968
}
2970
2969
case SN_CopyTo :
2971
- // FIXME:
2970
+ // FIXME: https://github.com/dotnet/runtime/issues/91394
2972
2971
return NULL ;
2973
2972
case SN_Clamp : {
2974
2973
if (!(!fsig -> hasthis && fsig -> param_count == 3 && mono_metadata_type_equal (fsig -> ret , type ) && mono_metadata_type_equal (fsig -> params [0 ], type ) && mono_metadata_type_equal (fsig -> params [1 ], type ) && mono_metadata_type_equal (fsig -> params [2 ], type )))
@@ -2991,7 +2990,7 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
2991
2990
case SN_LengthSquared :
2992
2991
case SN_Lerp :
2993
2992
case SN_Normalize : {
2994
- // FIXME:
2993
+ // FIXME: https://github.com/dotnet/runtime/issues/91394
2995
2994
return NULL ;
2996
2995
}
2997
2996
default :
@@ -5896,8 +5895,9 @@ arch_emit_simd_intrinsics (const char *class_ns, const char *class_name, MonoCom
5896
5895
}
5897
5896
5898
5897
if (!strcmp (class_ns , "System.Numerics" )) {
5899
- // FIXME: Support Vector2/Vector3
5900
- if (!strcmp (class_name , "Vector4" ) || !strcmp (class_name , "Quaternion" ) || !strcmp (class_name , "Plane" ))
5898
+ // FIXME: Support Vector2 https://github.com/dotnet/runtime/issues/81501
5899
+ if (!strcmp (class_name , "Vector2" ) || !strcmp (class_name , "Vector4" ) ||
5900
+ !strcmp (class_name , "Quaternion" ) || !strcmp (class_name , "Plane" ))
5901
5901
return emit_vector_2_3_4 (cfg , cmethod , fsig , args );
5902
5902
}
5903
5903
0 commit comments