@@ -548,12 +548,11 @@ emit_xcompare_for_intrinsic (MonoCompile *cfg, MonoClass *klass, int intrinsic_i
548548}
549549
550550static MonoInst *
551- emit_xequal (MonoCompile * cfg , MonoClass * klass , MonoInst * arg1 , MonoInst * arg2 )
551+ emit_xequal (MonoCompile * cfg , MonoClass * klass , MonoTypeEnum element_type , MonoInst * arg1 , MonoInst * arg2 )
552552{
553553#ifdef TARGET_ARM64
554554 if (!COMPILE_LLVM (cfg )) {
555- MonoTypeEnum elemt = get_underlying_type (m_class_get_this_arg (arg1 -> klass ));
556- MonoInst * cmp = emit_xcompare (cfg , arg1 -> klass , elemt , arg1 , arg2 );
555+ MonoInst * cmp = emit_xcompare (cfg , klass , element_type , arg1 , arg2 );
557556 MonoInst * ret = emit_simd_ins (cfg , mono_defaults .boolean_class , OP_XEXTRACT , cmp -> dreg , -1 );
558557 ret -> inst_c0 = SIMD_EXTR_ARE_ALL_SET ;
559558 ret -> inst_c1 = mono_class_value_size (klass , NULL );
@@ -572,9 +571,9 @@ emit_xequal (MonoCompile *cfg, MonoClass *klass, MonoInst *arg1, MonoInst *arg2)
572571}
573572
574573static MonoInst *
575- emit_not_xequal (MonoCompile * cfg , MonoClass * klass , MonoInst * arg1 , MonoInst * arg2 )
574+ emit_not_xequal (MonoCompile * cfg , MonoClass * klass , MonoTypeEnum element_type , MonoInst * arg1 , MonoInst * arg2 )
576575{
577- MonoInst * ins = emit_xequal (cfg , klass , arg1 , arg2 );
576+ MonoInst * ins = emit_xequal (cfg , klass , element_type , arg1 , arg2 );
578577 int sreg = ins -> dreg ;
579578 int dreg = alloc_ireg (cfg );
580579 MONO_EMIT_NEW_BIALU_IMM (cfg , OP_COMPARE_IMM , -1 , sreg , 0 );
@@ -1784,11 +1783,11 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
17841783 if (COMPILE_LLVM (cfg )) {
17851784 switch (id ) {
17861785 case SN_EqualsAll :
1787- return emit_xequal (cfg , arg_class , args [0 ], args [1 ]);
1786+ return emit_xequal (cfg , arg_class , arg0_type , args [0 ], args [1 ]);
17881787 case SN_EqualsAny : {
17891788 MonoInst * cmp_eq = emit_xcompare (cfg , arg_class , arg0_type , args [0 ], args [1 ]);
17901789 MonoInst * zero = emit_xzero (cfg , arg_class );
1791- return emit_not_xequal (cfg , arg_class , cmp_eq , zero );
1790+ return emit_not_xequal (cfg , arg_class , arg0_type , cmp_eq , zero );
17921791 }
17931792 }
17941793 } else {
@@ -1979,14 +1978,14 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
19791978 if (type_enum_is_float (arg0_type )) {
19801979 MonoInst * zero = emit_xzero (cfg , arg_class );
19811980 MonoInst * inverted_cmp = emit_xcompare (cfg , klass , arg0_type , cmp , zero );
1982- return emit_xequal (cfg , arg_class , inverted_cmp , zero );
1981+ return emit_xequal (cfg , arg_class , arg0_type , inverted_cmp , zero );
19831982 }
19841983
19851984 MonoInst * ones = emit_xones (cfg , arg_class );
1986- return emit_xequal (cfg , arg_class , cmp , ones );
1985+ return emit_xequal (cfg , arg_class , arg0_type , cmp , ones );
19871986 } else {
19881987 MonoInst * zero = emit_xzero (cfg , arg_class );
1989- return emit_not_xequal (cfg , arg_class , cmp , zero );
1988+ return emit_not_xequal (cfg , arg_class , arg0_type , cmp , zero );
19901989 }
19911990 } else {
19921991 MonoInst * cmp = emit_xcompare_for_intrinsic (cfg , arg_class , id , arg0_type , args [0 ], args [1 ]);
@@ -2516,8 +2515,8 @@ emit_vector64_vector128_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
25162515 return NULL ;
25172516 MonoClass * arg_class = mono_class_from_mono_type_internal (fsig -> params [0 ]);
25182517 switch (id ) {
2519- case SN_op_Equality : return emit_xequal (cfg , arg_class , args [0 ], args [1 ]);
2520- case SN_op_Inequality : return emit_not_xequal (cfg , arg_class , args [0 ], args [1 ]);
2518+ case SN_op_Equality : return emit_xequal (cfg , arg_class , arg0_type , args [0 ], args [1 ]);
2519+ case SN_op_Inequality : return emit_not_xequal (cfg , arg_class , arg0_type , args [0 ], args [1 ]);
25212520 default : g_assert_not_reached ();
25222521 }
25232522 }
@@ -2600,28 +2599,7 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
26002599 // when a method gets enabled should be removed from here
26012600 switch (id ) {
26022601 case SN_ctor :
2603- case SN_Clamp :
2604- case SN_Conjugate :
2605- case SN_CopyTo :
2606- case SN_Distance :
2607- case SN_DistanceSquared :
2608- case SN_Dot :
2609- case SN_Length :
2610- case SN_LengthSquared :
2611- case SN_Lerp :
2612- case SN_Negate :
2613- case SN_Normalize :
2614- case SN_get_Identity :
26152602 case SN_get_Item :
2616- case SN_get_One :
2617- case SN_get_UnitW :
2618- case SN_get_UnitX :
2619- case SN_get_UnitY :
2620- case SN_get_UnitZ :
2621- case SN_get_Zero :
2622- case SN_op_Equality :
2623- case SN_op_Inequality :
2624- case SN_op_UnaryNegation :
26252603 case SN_set_Item :
26262604 return NULL ;
26272605 default :
@@ -2789,8 +2767,7 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
27892767 }
27902768 case SN_Dot : {
27912769#if defined(TARGET_ARM64 ) || defined(TARGET_WASM )
2792- int instc0 = OP_FMUL ;
2793- MonoInst * pairwise_multiply = emit_simd_ins_for_sig (cfg , klass , OP_XBINOP , instc0 , MONO_TYPE_R4 , fsig , args );
2770+ MonoInst * pairwise_multiply = emit_simd_ins_for_sig (cfg , klass , OP_XBINOP , OP_FMUL , MONO_TYPE_R4 , fsig , args );
27942771 return emit_sum_vector (cfg , fsig -> params [0 ], MONO_TYPE_R4 , pairwise_multiply );
27952772#elif defined(TARGET_AMD64 )
27962773 if (!(mini_get_cpu_features (cfg ) & MONO_CPU_X86_SSE41 ))
@@ -2815,7 +2792,9 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
28152792 case SN_Negate :
28162793 case SN_op_UnaryNegation : {
28172794#if defined(TARGET_ARM64 ) || defined(TARGET_AMD64 )
2818- return emit_simd_ins (cfg , klass , OP_NEGATION , args [0 ]-> dreg , -1 );
2795+ ins = emit_simd_ins (cfg , klass , OP_NEGATION , args [0 ]-> dreg , -1 );
2796+ ins -> inst_c1 = MONO_TYPE_R4 ;
2797+ return ins ;
28192798#else
28202799 return NULL ;
28212800#endif
@@ -2840,13 +2819,13 @@ emit_vector_2_3_4 (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *f
28402819 if (!(fsig -> param_count == 2 && mono_metadata_type_equal (fsig -> params [0 ], type ) && mono_metadata_type_equal (fsig -> params [1 ], type )))
28412820 return NULL ;
28422821 MonoClass * arg_class = mono_class_from_mono_type_internal (fsig -> params [0 ]);
2843- return emit_xequal (cfg , arg_class , args [0 ], args [1 ]);
2822+ return emit_xequal (cfg , arg_class , MONO_TYPE_R4 , args [0 ], args [1 ]);
28442823 }
28452824 case SN_op_Inequality : {
28462825 if (!(fsig -> param_count == 2 && mono_metadata_type_equal (fsig -> params [0 ], type ) && mono_metadata_type_equal (fsig -> params [1 ], type )))
28472826 return NULL ;
28482827 MonoClass * arg_class = mono_class_from_mono_type_internal (fsig -> params [0 ]);
2849- return emit_not_xequal (cfg , arg_class , args [0 ], args [1 ]);
2828+ return emit_not_xequal (cfg , arg_class , MONO_TYPE_R4 , args [0 ], args [1 ]);
28502829 }
28512830 case SN_SquareRoot : {
28522831#ifdef TARGET_ARM64
@@ -3207,8 +3186,8 @@ emit_sys_numerics_vector_t (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSig
32073186 mono_metadata_type_equal (fsig -> params [0 ], type ) &&
32083187 mono_metadata_type_equal (fsig -> params [1 ], type ));
32093188 switch (id ) {
3210- case SN_op_Equality : return emit_xequal (cfg , klass , args [0 ], args [1 ]);
3211- case SN_op_Inequality : return emit_not_xequal (cfg , klass , args [0 ], args [1 ]);
3189+ case SN_op_Equality : return emit_xequal (cfg , klass , etype -> type , args [0 ], args [1 ]);
3190+ case SN_op_Inequality : return emit_not_xequal (cfg , klass , etype -> type , args [0 ], args [1 ]);
32123191 default : g_assert_not_reached ();
32133192 }
32143193 case SN_GreaterThan :
0 commit comments