@@ -1805,9 +1805,6 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
18051805#ifdef TARGET_WASM
18061806 return emit_simd_ins_for_sig (cfg , klass , OP_WASM_SIMD_BITMASK , -1 , -1 , fsig , args );
18071807#elif defined(TARGET_ARM64 )
1808- if (COMPILE_LLVM (cfg ))
1809- return NULL ;
1810-
18111808 MonoInst * result_ins = NULL ;
18121809 MonoClass * arg_class = mono_class_from_mono_type_internal (fsig -> params [0 ]);
18131810 int size = mono_class_value_size (arg_class , NULL );
@@ -1819,27 +1816,22 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
18191816 and_res_vec -> sreg2 = msb_mask_vec -> dreg ;
18201817
18211818 MonoInst * msb_shift_vec = emit_msb_shift_vector_constant (cfg , arg_class , arg0_type );
1822- MonoInst * shift_res_vec = emit_simd_ins (cfg , arg_class , OP_ARM64_USHL , and_res_vec -> dreg , msb_shift_vec -> dreg );
1819+
1820+ MonoInst * shift_res_vec = emit_simd_ins (cfg , arg_class , OP_XOP_OVR_X_X_X , and_res_vec -> dreg , msb_shift_vec -> dreg );
1821+ shift_res_vec -> inst_c0 = INTRINS_AARCH64_ADV_SIMD_USHL ;
18231822 shift_res_vec -> inst_c1 = arg0_type ;
18241823
18251824 if (arg0_type == MONO_TYPE_I1 || arg0_type == MONO_TYPE_U1 ) {
1826- // Always perform usigned operations as vector sum and extract operations could sign-extend the result into the GP register
1825+ // Always perform unsigned operations as vector sum and extract operations could sign-extend the result into the GP register
18271826 // making the final result invalid. This is not needed for wider type as the maximum sum of extracted MSB cannot be larger than 8bits
18281827 arg0_type = MONO_TYPE_U1 ;
18291828
1830- // In order to sum high and low 64bits of the shifted vector separatly, we use a zeroed vector and the extract operation
1831- MonoInst * zero_vec = emit_xzero (cfg , arg_class );
1832-
1833- MonoInst * ext_low_vec = emit_simd_ins (cfg , arg_class , OP_ARM64_EXT_IMM , zero_vec -> dreg , shift_res_vec -> dreg );
1834- ext_low_vec -> inst_c0 = 8 ;
1835- ext_low_vec -> inst_c1 = arg0_type ;
1829+ MonoInst * ext_low_vec = emit_simd_ins_for_sig (cfg , arg_class , OP_XLOWER , 8 , arg0_type , fsig , & shift_res_vec );
18361830 MonoInst * sum_low_vec = emit_sum_vector (cfg , fsig -> params [0 ], arg0_type , ext_low_vec );
1837-
1838- MonoInst * ext_high_vec = emit_simd_ins (cfg , arg_class , OP_ARM64_EXT_IMM , shift_res_vec -> dreg , zero_vec -> dreg );
1839- ext_high_vec -> inst_c0 = 8 ;
1840- ext_high_vec -> inst_c1 = arg0_type ;
1841- MonoInst * sum_high_vec = emit_sum_vector (cfg , fsig -> params [0 ], arg0_type , ext_high_vec );
1842-
1831+
1832+ MonoInst * ext_high_vec = emit_simd_ins_for_sig (cfg , arg_class , OP_XUPPER , 8 , arg0_type , fsig , & shift_res_vec );
1833+ MonoInst * sum_high_vec = emit_sum_vector (cfg , fsig -> params [0 ], arg0_type , ext_high_vec );
1834+
18431835 MONO_EMIT_NEW_BIALU_IMM (cfg , OP_SHL_IMM , sum_high_vec -> dreg , sum_high_vec -> dreg , 8 );
18441836 EMIT_NEW_BIALU (cfg , result_ins , OP_IOR , sum_high_vec -> dreg , sum_high_vec -> dreg , sum_low_vec -> dreg );
18451837 } else {
0 commit comments