Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24a89e1

Browse files
committed
Fix the vector concatenation overloads of Vector128/256
1 parentca728df commit24a89e1

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

‎src/mono/mono/mini/mini-llvm.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7550,6 +7550,10 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
75507550
values [ins->dreg]=LLVMBuildBitCast (builder,lhs,t,"");
75517551
break;
75527552
}
7553+
caseOP_XCONCAT: {
7554+
values [ins->dreg]=concatenate_vectors (ctx,lhs,rhs);
7555+
break;
7556+
}
75537557
#endif// defined(TARGET_X86) || defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_WASM)
75547558

75557559
#if defined(TARGET_X86)|| defined(TARGET_AMD64)|| defined(TARGET_WASM)

‎src/mono/mono/mini/mini-ops.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,8 @@ MINI_OP(OP_XOP_OVR_SCALAR_X_X_X, "xop_ovr_scalar_x_x_x", XREG, XREG, XREG)
15651565
MINI_OP3(OP_XOP_OVR_SCALAR_X_X_X_X,"xop_ovr_scalar_x_x_x_x",XREG,XREG,XREG,XREG)
15661566
MINI_OP(OP_XOP_OVR_BYSCALAR_X_X_X,"xop_ovr_byscalar_x_x_x",XREG,XREG,XREG)
15671567

1568+
MINI_OP(OP_XCONCAT,"xconcat",XREG,XREG,XREG)
1569+
15681570
MINI_OP(OP_XCAST,"xcast",XREG,XREG,NONE)
15691571
/* Extract element of vector */
15701572
/* The index is assumed to be in range */

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

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,15 @@ emit_xcompare (MonoCompile *cfg, MonoClass *klass, MonoTypeEnum etype, MonoInst
257257
returnins;
258258
}
259259

260+
staticgboolean
261+
is_intrinsics_vector_type (MonoType*vector_type)
262+
{
263+
if (vector_type->type!=MONO_TYPE_GENERICINST)return FALSE;
264+
MonoClass*klass=mono_class_from_mono_type_internal (vector_type);
265+
constchar*name=m_class_get_name (klass);
266+
return !strcmp (name,"Vector64`1")|| !strcmp (name,"Vector128`1")|| !strcmp (name,"Vector256`1");
267+
}
268+
260269
staticMonoType*
261270
get_vector_t_elem_type (MonoType*vector_type)
262271
{
@@ -487,6 +496,28 @@ static guint16 sri_vector_methods [] = {
487496
SN_CreateScalarUnsafe,
488497
};
489498

499+
staticgboolean
500+
is_elementwise_create_overload (MonoMethodSignature*fsig,MonoType*ret_type)
501+
{
502+
uint16_tparam_count=fsig->param_count;
503+
if (param_count<1)return FALSE;
504+
MonoType*type=fsig->params [0];
505+
gbooleanis_vector_primitive=MONO_TYPE_IS_PRIMITIVE (type)&& (type->type >=MONO_TYPE_I1&&type->type <=MONO_TYPE_R8);
506+
if (!is_vector_primitive)return FALSE;
507+
if (!mono_metadata_type_equal (ret_type,type))return FALSE;
508+
for (uint16_ti=1;i<param_count;++i)
509+
if (!mono_metadata_type_equal (type,fsig->params [i]))return FALSE;
510+
return TRUE;
511+
}
512+
513+
staticgboolean
514+
is_create_from_half_vectors_overload (MonoMethodSignature*fsig)
515+
{
516+
if (fsig->param_count!=2)return FALSE;
517+
if (!is_intrinsics_vector_type (fsig->params [0]))return FALSE;
518+
returnmono_metadata_type_equal (fsig->params [0],fsig->params [1]);
519+
}
520+
490521
staticMonoInst*
491522
emit_sri_vector (MonoCompile*cfg,MonoMethod*cmethod,MonoMethodSignature*fsig,MonoInst**args)
492523
{
@@ -519,8 +550,11 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
519550
MonoType*etype=get_vector_t_elem_type (fsig->ret);
520551
if (fsig->param_count==1&&mono_metadata_type_equal (fsig->params [0],etype))
521552
returnemit_simd_ins (cfg,klass,type_to_expand_op (etype),args [0]->dreg,-1);
522-
else
553+
elseif (is_create_from_half_vectors_overload (fsig))
554+
returnemit_simd_ins (cfg,klass,OP_XCONCAT,args [0]->dreg,args [1]->dreg);
555+
elseif (is_elementwise_create_overload (fsig,etype))
523556
returnemit_vector_create_elementwise (cfg,fsig,fsig->ret,etype,args);
557+
break;
524558
}
525559
caseSN_CreateScalarUnsafe:
526560
returnemit_simd_ins_for_sig (cfg,klass,OP_CREATE_SCALAR_UNSAFE,-1,arg0_type,fsig,args);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp