1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-19 16:40:26 +02:00

Start of SIMD support

This commit is contained in:
Brian Fiete 2020-08-23 05:42:42 -07:00
parent 73e260c1d5
commit 64b62c09be
30 changed files with 5846 additions and 5096 deletions

View file

@ -309,6 +309,15 @@ namespace System
}
[AttributeUsage(.Struct)]
public struct UnderlyingArrayAttribute : Attribute
{
public this(Type t, int size, bool isVector)
{
}
}
[AttributeUsage(.Field | .Method /*2*/)]
public struct NoShowAttribute : Attribute
{

View file

@ -0,0 +1,14 @@
namespace System.Numerics
{
[UnderlyingArray(typeof(bool), 4, true)]
struct bool4
{
public bool x;
public bool y;
public bool z;
public bool w;
[Intrinsic("and")]
public static extern bool4 operator&(bool4 lhs, bool4 rhs);
}
}

View file

@ -0,0 +1,89 @@
namespace System.Numerics
{
[UnderlyingArray(typeof(float), 4, true)]
struct float4
{
public float x;
public float y;
public float z;
public float w;
public this()
{
this = default;
}
public this(float x, float y, float z, float w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
public extern float4 wzyx { [Intrinsic("shuffle3210")] get; [Intrinsic("shuffle3210")] set; }
[Intrinsic("add")]
public static extern float4 operator+(float4 lhs, float4 rhs);
[Intrinsic("add"), Commutable]
public static extern float4 operator+(float4 lhs, float rhs);
[Intrinsic("add")]
public static extern float4 operator++(float4 lhs);
[Intrinsic("sub")]
public static extern float4 operator-(float4 lhs, float4 rhs);
[Intrinsic("sub"), Commutable]
public static extern float4 operator-(float4 lhs, float rhs);
[Intrinsic("sub")]
public static extern float4 operator--(float4 lhs);
[Intrinsic("mul")]
public static extern float4 operator*(float4 lhs, float4 rhs);
[Intrinsic("mul"), Commutable]
public static extern float4 operator*(float4 lhs, float rhs);
[Intrinsic("div")]
public static extern float4 operator/(float4 lhs, float4 rhs);
[Intrinsic("div")]
public static extern float4 operator/(float4 lhs, float rhs);
[Intrinsic("div")]
public static extern float4 operator/(float lhs, float4 rhs);
[Intrinsic("mod")]
public static extern float4 operator%(float4 lhs, float4 rhs);
[Intrinsic("mod")]
public static extern float4 operator%(float4 lhs, float rhs);
[Intrinsic("mod")]
public static extern float4 operator%(float lhs, float4 rhs);
[Intrinsic("eq")]
public static extern bool4 operator==(float4 lhs, float4 rhs);
[Intrinsic("eq"), Commutable]
public static extern bool4 operator==(float4 lhs, float rhs);
[Intrinsic("neq")]
public static extern bool4 operator!=(float4 lhs, float4 rhs);
[Intrinsic("neq"), Commutable]
public static extern bool4 operator!=(float4 lhs, float rhs);
[Intrinsic("lt")]
public static extern bool4 operator<(float4 lhs, float4 rhs);
[Intrinsic("lt")]
public static extern bool4 operator<(float4 lhs, float rhs);
[Intrinsic("lte")]
public static extern bool4 operator<=(float4 lhs, float4 rhs);
[Intrinsic("lte")]
public static extern bool4 operator<=(float4 lhs, float rhs);
[Intrinsic("gt")]
public static extern bool4 operator>(float4 lhs, float4 rhs);
[Intrinsic("gt")]
public static extern bool4 operator>(float4 lhs, float rhs);
[Intrinsic("gte")]
public static extern bool4 operator>=(float4 lhs, float4 rhs);
[Intrinsic("gte")]
public static extern bool4 operator>=(float4 lhs, float rhs);
}
}

View file

@ -3,7 +3,7 @@ namespace System
[AlwaysInclude]
struct SizedArray<T, CSize> where CSize : const int
{
T[CSize] mVal;
protected T[CSize] mVal;
public int Count
{