Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,57 @@ public abstract class PackedSimd
public static Vector128<nint> CompareGreaterThanOrEqual(Vector128<nint> left, Vector128<nint> right) { throw new PlatformNotSupportedException(); }
public static Vector128<nuint> CompareGreaterThanOrEqual(Vector128<nuint> left, Vector128<nuint> right) { throw new PlatformNotSupportedException(); }

// Floating-point sign bit operations

public static Vector128<float> Negate(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Negate(Vector128<double> value) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Abs(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Abs(Vector128<double> value) { throw new PlatformNotSupportedException(); }

// Floating-point min and max

public static Vector128<float> Min(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Min(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Max(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Max(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> PseudoMin(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> PseudoMin(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> PseudoMax(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> PseudoMax(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

// Floating-point arithmetic

public static Vector128<float> Add(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Add(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Subtract(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Subtract(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Divide(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Divide(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Multiply(Vector128<float> left, Vector128<float> right) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Multiply(Vector128<double> left, Vector128<double> right) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Sqrt(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Sqrt(Vector128<double> value) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Ceiling(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Ceiling(Vector128<double> value) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Floor(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Floor(Vector128<double> value) { throw new PlatformNotSupportedException(); }

public static Vector128<float> Truncate(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> Truncate(Vector128<double> value) { throw new PlatformNotSupportedException(); }

public static Vector128<float> RoundToNearest(Vector128<float> value) { throw new PlatformNotSupportedException(); }
public static Vector128<double> RoundToNearest(Vector128<double> value) { throw new PlatformNotSupportedException(); }

// Conversions

internal static Vector128<sbyte> ConvertNarrowingSignedSaturate(Vector128<short> lower, Vector128<short> upper) { throw new PlatformNotSupportedException(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,177 @@ public abstract class PackedSimd
[Intrinsic]
public static Vector128<nuint> CompareGreaterThanOrEqual(Vector128<nuint> left, Vector128<nuint> right) => CompareGreaterThanOrEqual(left, right);

// Floating-point sign bit operations

/// <summary>
/// f32x4.neg
/// </summary>
[Intrinsic]
public static Vector128<float> Negate(Vector128<float> value) => Negate(value);
/// <summary>
/// f64x2.neg
/// </summary>
[Intrinsic]
public static Vector128<double> Negate(Vector128<double> value) => Negate(value);

/// <summary>
/// f32x4.abs
/// </summary>
[Intrinsic]
public static Vector128<float> Abs(Vector128<float> value) => Abs(value);
/// <summary>
/// f64x2.abs
/// </summary>
[Intrinsic]
public static Vector128<double> Abs(Vector128<double> value) => Abs(value);

// Floating-point min and max

/// <summary>
/// f32x4.min
/// </summary>
[Intrinsic]
public static Vector128<float> Min(Vector128<float> left, Vector128<float> right) => Min(left, right);
/// <summary>
/// f64x2.min
/// </summary>
[Intrinsic]
public static Vector128<double> Min(Vector128<double> left, Vector128<double> right) => Min(left, right);

/// <summary>
/// f32x4.max
/// </summary>
[Intrinsic]
public static Vector128<float> Max(Vector128<float> left, Vector128<float> right) => Max(left, right);
/// <summary>
/// f64x2.max
/// </summary>
[Intrinsic]
public static Vector128<double> Max(Vector128<double> left, Vector128<double> right) => Max(left, right);

/// <summary>
/// f32x4.pmin
/// </summary>
[Intrinsic]
public static Vector128<float> PseudoMin(Vector128<float> left, Vector128<float> right) => PseudoMin(left, right);
/// <summary>
/// f64x2.pmin
/// </summary>
[Intrinsic]
public static Vector128<double> PseudoMin(Vector128<double> left, Vector128<double> right) => PseudoMin(left, right);

/// <summary>
/// f32x4.pmax
/// </summary>
[Intrinsic]
public static Vector128<float> PseudoMax(Vector128<float> left, Vector128<float> right) => PseudoMax(left, right);
/// <summary>
/// f64x2.pmax
/// </summary>
[Intrinsic]
public static Vector128<double> PseudoMax(Vector128<double> left, Vector128<double> right) => PseudoMax(left, right);

// Floating-point arithmetic

/// <summary>
/// f32x4.add
/// </summary>
[Intrinsic]
public static Vector128<float> Add(Vector128<float> left, Vector128<float> right) => Add(left, right);
/// <summary>
/// f64x2.add
/// </summary>
[Intrinsic]
public static Vector128<double> Add(Vector128<double> left, Vector128<double> right) => Add(left, right);

/// <summary>
/// f32x4.sub
/// </summary>
[Intrinsic]
public static Vector128<float> Subtract(Vector128<float> left, Vector128<float> right) => Subtract(left, right);
/// <summary>
/// f64x2.sub
/// </summary>
[Intrinsic]
public static Vector128<double> Subtract(Vector128<double> left, Vector128<double> right) => Subtract(left, right);

/// <summary>
/// f32x4.div
/// </summary>
[Intrinsic]
public static Vector128<float> Divide(Vector128<float> left, Vector128<float> right) => Divide(left, right);
/// <summary>
/// f64x2.div
/// </summary>
[Intrinsic]
public static Vector128<double> Divide(Vector128<double> left, Vector128<double> right) => Divide(left, right);

/// <summary>
/// f32x4.mul
/// </summary>
[Intrinsic]
public static Vector128<float> Multiply(Vector128<float> left, Vector128<float> right) => Multiply(left, right);
/// <summary>
/// f64x2.mul
/// </summary>
[Intrinsic]
public static Vector128<double> Multiply(Vector128<double> left, Vector128<double> right) => Multiply(left, right);

/// <summary>
/// f32x4.sqrt
/// </summary>
[Intrinsic]
public static Vector128<float> Sqrt(Vector128<float> value) => Sqrt(value);
/// <summary>
/// f64x2.sqrt
/// </summary>
[Intrinsic]
public static Vector128<double> Sqrt(Vector128<double> value) => Sqrt(value);

/// <summary>
/// f32x4.ceil
/// </summary>
[Intrinsic]
public static Vector128<float> Ceiling(Vector128<float> value) => Ceiling(value);
/// <summary>
/// f64x2.ceil
/// </summary>
[Intrinsic]
public static Vector128<double> Ceiling(Vector128<double> value) => Ceiling(value);

/// <summary>
/// f32x4.floor
/// </summary>
[Intrinsic]
public static Vector128<float> Floor(Vector128<float> value) => Floor(value);
/// <summary>
/// f64x2.floor
/// </summary>
[Intrinsic]
public static Vector128<double> Floor(Vector128<double> value) => Floor(value);

/// <summary>
/// f32x4.trunc
/// </summary>
[Intrinsic]
public static Vector128<float> Truncate(Vector128<float> value) => Truncate(value);
/// <summary>
/// f64x2.trunc
/// </summary>
[Intrinsic]
public static Vector128<double> Truncate(Vector128<double> value) => Truncate(value);

/// <summary>
/// f32x4.nearest
/// </summary>
[Intrinsic]
public static Vector128<float> RoundToNearest(Vector128<float> value) => RoundToNearest(value);
/// <summary>
/// f64x2.nearest
/// </summary>
[Intrinsic]
public static Vector128<double> RoundToNearest(Vector128<double> value) => RoundToNearest(value);

// Conversions

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6319,5 +6319,35 @@ public abstract partial class PackedSimd
public static Vector128<double> CompareGreaterThanOrEqual(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<nint> CompareGreaterThanOrEqual(Vector128<nint> left, Vector128<nint> right) { throw null; }
public static Vector128<nuint> CompareGreaterThanOrEqual(Vector128<nuint> left, Vector128<nuint> right) { throw null; }
public static Vector128<float> Negate(Vector128<float> value) { throw null; }
public static Vector128<double> Negate(Vector128<double> value) { throw null; }
public static Vector128<float> Abs(Vector128<float> value) { throw null; }
public static Vector128<double> Abs(Vector128<double> value) { throw null; }
public static Vector128<float> Min(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> Min(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> Max(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> Max(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> PseudoMin(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> PseudoMin(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> PseudoMax(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> PseudoMax(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> Add(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> Add(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> Subtract(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> Subtract(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> Divide(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> Divide(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> Multiply(Vector128<float> left, Vector128<float> right) { throw null; }
public static Vector128<double> Multiply(Vector128<double> left, Vector128<double> right) { throw null; }
public static Vector128<float> Sqrt(Vector128<float> value) { throw null; }
public static Vector128<double> Sqrt(Vector128<double> value) { throw null; }
public static Vector128<float> Ceiling(Vector128<float> value) { throw null; }
public static Vector128<double> Ceiling(Vector128<double> value) { throw null; }
public static Vector128<float> Floor(Vector128<float> value) { throw null; }
public static Vector128<double> Floor(Vector128<double> value) { throw null; }
public static Vector128<float> Truncate(Vector128<float> value) { throw null; }
public static Vector128<double> Truncate(Vector128<double> value) { throw null; }
public static Vector128<float> RoundToNearest(Vector128<float> value) { throw null; }
public static Vector128<double> RoundToNearest(Vector128<double> value) { throw null; }
}
}
18 changes: 12 additions & 6 deletions src/mono/mono/mini/llvm-intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ INTRINS(PEXT_I64, x86_bmi_pext_64, X86)
INTRINS(PDEP_I32, x86_bmi_pdep_32, X86)
INTRINS(PDEP_I64, x86_bmi_pdep_64, X86)

INTRINS_OVR(SIMD_SQRT_R8, sqrt, Generic, sse_r8_t)
INTRINS_OVR(SIMD_SQRT_R4, sqrt, Generic, sse_r4_t)
INTRINS_OVR_TAG(SIMD_FLOOR, floor, Generic, Scalar | V64 | V128 | R4 | R8)
INTRINS_OVR_TAG(SIMD_CEIL, ceil, Generic, Scalar | V64 | V128 | R4 | R8)
INTRINS_OVR_TAG(SIMD_TRUNC, trunc, Generic, Scalar | V64 | V128 | R4 | R8)
INTRINS_OVR_TAG(SIMD_ROUND, round, Generic, Scalar | V64 | V128 | R4 | R8)
INTRINS_OVR_TAG(SIMD_NEAREST, nearbyint, Generic, V64 | V128 | R4 | R8)

#if LLVM_API_VERSION >= 1400
INTRINS_OVR_TAG(ROUNDEVEN, roundeven, Generic, Scalar | V64 | V128 | R4 | R8)
#endif
Expand All @@ -124,8 +132,6 @@ INTRINS(SSE_PSRL_Q, x86_sse2_psrl_q, X86)
INTRINS(SSE_PSLL_W, x86_sse2_psll_w, X86)
INTRINS(SSE_PSLL_D, x86_sse2_psll_d, X86)
INTRINS(SSE_PSLL_Q, x86_sse2_psll_q, X86)
INTRINS_OVR(SSE_SQRT_PD, sqrt, Generic, sse_r8_t)
INTRINS_OVR(SSE_SQRT_PS, sqrt, Generic, sse_r4_t)
INTRINS_OVR(SSE_SQRT_SD, sqrt, Generic, LLVMDoubleType ())
INTRINS_OVR(SSE_SQRT_SS, sqrt, Generic, LLVMFloatType ())
INTRINS(SSE_RCP_PS, x86_sse_rcp_ps, X86)
Expand Down Expand Up @@ -283,6 +289,10 @@ INTRINS_OVR_2_ARG(WASM_NARROW_SIGNED_V16, wasm_narrow_signed, Wasm, sse_i1_t, ss
INTRINS_OVR_2_ARG(WASM_NARROW_SIGNED_V8, wasm_narrow_signed, Wasm, sse_i2_t, sse_i4_t)
INTRINS_OVR_2_ARG(WASM_NARROW_UNSIGNED_V16, wasm_narrow_unsigned, Wasm, sse_i1_t, sse_i2_t)
INTRINS_OVR_2_ARG(WASM_NARROW_UNSIGNED_V8, wasm_narrow_unsigned, Wasm, sse_i2_t, sse_i4_t)
INTRINS_OVR_TAG(WASM_PMAX, wasm_pmax, Wasm, R4 | R8)
INTRINS_OVR_TAG(WASM_PMIN, wasm_pmin, Wasm, R4 | R8)
INTRINS_OVR(WASM_PMAX_V4, fabs, Generic, sse_r4_t)
INTRINS_OVR(WASM_PMAX_V2, fabs, Generic, sse_r8_t)
INTRINS(WASM_Q15MULR_SAT_SIGNED, wasm_q15mulr_sat_signed, Wasm)
INTRINS(WASM_SHUFFLE, wasm_shuffle, Wasm)
INTRINS_OVR(WASM_SUB_SAT_SIGNED_V16, wasm_sub_sat_signed, Wasm, sse_i1_t)
Expand Down Expand Up @@ -436,13 +446,9 @@ INTRINS_OVR_TAG(AARCH64_ADV_SIMD_FRECPS, aarch64_neon_frecps, Arm64, Scalar | V6
INTRINS_OVR_TAG(AARCH64_ADV_SIMD_RBIT, aarch64_neon_rbit, Arm64, V64 | V128 | I1)
#endif

INTRINS_OVR_TAG(AARCH64_ADV_SIMD_FRINTA, round, Generic, Scalar | V64 | V128 | R4 | R8)
#if LLVM_API_VERSION < 1400
INTRINS_OVR_TAG(AARCH64_ADV_SIMD_FRINTN, aarch64_neon_frintn, Arm64, Scalar | V64 | V128 | R4 | R8)
#endif
INTRINS_OVR_TAG(AARCH64_ADV_SIMD_FRINTM, floor, Generic, Scalar | V64 | V128 | R4 | R8)
INTRINS_OVR_TAG(AARCH64_ADV_SIMD_FRINTP, ceil, Generic, Scalar | V64 | V128 | R4 | R8)
INTRINS_OVR_TAG(AARCH64_ADV_SIMD_FRINTZ, trunc, Generic, Scalar | V64 | V128 | R4 | R8)

INTRINS_OVR_TAG(AARCH64_ADV_SIMD_SUQADD, aarch64_neon_suqadd, Arm64, Scalar | V64 | V128 | I1 | I2 | I4 | I8)
INTRINS_OVR_TAG(AARCH64_ADV_SIMD_USQADD, aarch64_neon_usqadd, Arm64, Scalar | V64 | V128 | I1 | I2 | I4 | I8)
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/mini/mini-llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -11546,8 +11546,6 @@ MONO_RESTORE_WARNING
values [ins->dreg] = result;
break;
}
#endif
#if defined(TARGET_ARM64) || defined(TARGET_AMD64)
case OP_NEGATION:
case OP_NEGATION_SCALAR: {
gboolean scalar = ins->opcode == OP_NEGATION_SCALAR;
Expand All @@ -11565,6 +11563,8 @@ MONO_RESTORE_WARNING
values [ins->dreg] = result;
break;
}
#endif
#if defined(TARGET_ARM64) || defined(TARGET_AMD64)
case OP_ONES_COMPLEMENT: {
LLVMTypeRef ret_t = LLVMTypeOf (lhs);
LLVMValueRef result = bitcast_to_integral (ctx, lhs);
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/mini/mini-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -1803,8 +1803,6 @@ MINI_OP(OP_WASM_ONESCOMPLEMENT, "wasm_onescomplement", XREG, XREG, NONE)
#endif

#if defined(TARGET_ARM64) || defined(TARGET_AMD64)
MINI_OP(OP_NEGATION, "negate", XREG, XREG, NONE)
MINI_OP(OP_NEGATION_SCALAR, "negate_scalar", XREG, XREG, NONE)
MINI_OP(OP_ONES_COMPLEMENT, "ones_complement", XREG, XREG, NONE)

MINI_OP(OP_CVT_FP_UI, "convert_fp_to_ui", XREG, XREG, NONE)
Expand All @@ -1819,6 +1817,8 @@ MINI_OP(OP_CVT_SI_FP_SCALAR, "convert_si_to_fp_scalar", XREG, XREG, NONE)
#endif // TARGET_ARM64 || TARGET_AMD64

#if defined(TARGET_ARM64) || defined(TARGET_AMD64) || defined(TARGET_WASM)
MINI_OP(OP_NEGATION, "negate", XREG, XREG, NONE)
MINI_OP(OP_NEGATION_SCALAR, "negate_scalar", XREG, XREG, NONE)
MINI_OP3(OP_BSL, "bitwise_select", XREG, XREG, XREG, XREG)
#endif // TARGET_ARM64 || TARGET_AMD64 || TARGET_WASM

Expand Down
Loading