Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Mono to handle various other vector bitcast APIs #104049

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mono/mono/mini/interp/interp-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#define MINT_STACK_ALIGNMENT (2 * MINT_STACK_SLOT_SIZE)
#define MINT_SIMD_ALIGNMENT (MINT_STACK_ALIGNMENT)
#define SIZEOF_V128 16
#define SIZEOF_V2 8
#define SIZEOF_V3 12

#define INTERP_STACK_SIZE (1024*1024)
#define INTERP_REDZONE_SIZE (8*1024)
Expand Down
8 changes: 8 additions & 0 deletions src/mono/mono/mini/interp/interp-simd-intrins.def
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ INTERP_SIMD_INTRINSIC_P_PP (INTERP_SIMD_INTRINSIC_V128_R4_MULTIPLY, interp_v128_

INTERP_SIMD_INTRINSIC_P_PP (INTERP_SIMD_INTRINSIC_V128_R4_DIVISION, interp_v128_r4_op_division, 231)

INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_AS_V2, interp_v128_as_v2, -1)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_AS_V3, interp_v128_as_v3, -1)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_BITCAST, interp_v128_bitcast, -1)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_FROM_V2, interp_v128_from_v2, -1)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_FROM_V2_UNSAFE, interp_v128_from_v2_unsafe, -1)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_FROM_V3, interp_v128_from_v3, -1)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_FROM_V3_UNSAFE, interp_v128_from_v3_unsafe, -1)

INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_I1_NEGATION, interp_v128_i1_op_negation, 97)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_I2_NEGATION, interp_v128_i2_op_negation, 129)
INTERP_SIMD_INTRINSIC_P_P (INTERP_SIMD_INTRINSIC_V128_I4_NEGATION, interp_v128_i4_op_negation, 161)
Expand Down
82 changes: 82 additions & 0 deletions src/mono/mono/mini/interp/interp-simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,88 @@ interp_v128_i4_all_bits_set (gpointer res)
memset (res, 0xff, SIZEOF_V128);
}

// Vector2 AsVector2(Vector128<float> v1)
static void
interp_v128_as_v2 (gpointer res, gpointer v1)
{
float *res_typed = (float*)res;
float *v1_typed = (float*)v1;

res_typed [0] = v1_typed [0];
res_typed [1] = v1_typed [1];
}

// Vector3 AsVector3(Vector128<float> v1)
static void
interp_v128_as_v3 (gpointer res, gpointer v1)
{
float *res_typed = (float*)res;
float *v1_typed = (float*)v1;

res_typed [0] = v1_typed [0];
res_typed [1] = v1_typed [1];
res_typed [2] = v1_typed [2];
}

// Vector128<TTo> As<TFrom, TTo>(Vector128<TFrom> v1)
static void
interp_v128_bitcast (gpointer res, gpointer v1)
{
*(v128_i1*)res = *(v128_i1*)v1;
}

// Vector128<float> AsVector128(Vector2 v1)
static void
interp_v128_from_v2 (gpointer res, gpointer v1)
{
float *res_typed = (float*)res;
float *v1_typed = (float*)v1;

res_typed [0] = v1_typed [0];
res_typed [1] = v1_typed [1];
res_typed [2] = 0;
res_typed [3] = 0;
}

// Vector128<float> AsVector128Unsafe(Vector2 v1)
static void
interp_v128_from_v2_unsafe (gpointer res, gpointer v1)
{
float *res_typed = (float*)res;
float *v1_typed = (float*)v1;

res_typed [0] = v1_typed [0];
res_typed [1] = v1_typed [1];
res_typed [2] = 0;
res_typed [3] = 0;
}

// Vector128<float> AsVector128(Vector3 v1)
static void
interp_v128_from_v3 (gpointer res, gpointer v1)
{
float *res_typed = (float*)res;
float *v1_typed = (float*)v1;

res_typed [0] = v1_typed [0];
res_typed [1] = v1_typed [1];
res_typed [2] = v1_typed [2];
res_typed [3] = 0;
}

// Vector128<float> AsVector128Unsafe(Vector3 v1)
static void
interp_v128_from_v3_unsafe (gpointer res, gpointer v1)
{
float *res_typed = (float*)res;
float *v1_typed = (float*)v1;

res_typed [0] = v1_typed [0];
res_typed [1] = v1_typed [1];
res_typed [2] = v1_typed [2];
res_typed [3] = 0;
}

// op_Addition
static void
interp_v128_i1_op_addition (gpointer res, gpointer v1, gpointer v2)
Expand Down
21 changes: 21 additions & 0 deletions src/mono/mono/mini/interp/simd-methods.def
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ SIMD_METHOD(op_UnaryNegation)
SIMD_METHOD(op_UnsignedRightShift)

SIMD_METHOD(AndNot)
SIMD_METHOD(As)
SIMD_METHOD(AsByte)
SIMD_METHOD(AsDouble)
SIMD_METHOD(AsInt16)
SIMD_METHOD(AsInt32)
SIMD_METHOD(AsInt64)
SIMD_METHOD(AsNInt)
SIMD_METHOD(AsNUInt)
SIMD_METHOD(AsPlane)
SIMD_METHOD(AsQuaternion)
SIMD_METHOD(AsSByte)
SIMD_METHOD(AsSingle)
SIMD_METHOD(AsUInt16)
SIMD_METHOD(AsUInt32)
SIMD_METHOD(AsUInt64)
SIMD_METHOD(AsVector)
SIMD_METHOD(AsVector2)
SIMD_METHOD(AsVector3)
SIMD_METHOD(AsVector4)
SIMD_METHOD(AsVector128)
SIMD_METHOD(AsVector128Unsafe)
SIMD_METHOD(ConditionalSelect)
SIMD_METHOD(Create)
SIMD_METHOD(CreateScalar)
Expand Down
Loading
Loading