using System.Diagnostics; using System.Runtime.InteropServices; namespace Unity.Burst.Intrinsics { /// /// Represents a 128-bit SIMD value /// [StructLayout(LayoutKind.Explicit)] [DebuggerTypeProxy(typeof(V128DebugView))] public struct v128 { /// /// Get the 0th Byte of the vector /// [FieldOffset(0)] public byte Byte0; /// /// Get the 1st Byte of the vector /// [FieldOffset(1)] public byte Byte1; /// /// Get the 2nd Byte of the vector /// [FieldOffset(2)] public byte Byte2; /// /// Get the 3rd Byte of the vector /// [FieldOffset(3)] public byte Byte3; /// /// Get the 4th Byte of the vector /// [FieldOffset(4)] public byte Byte4; /// /// Get the 5th Byte of the vector /// [FieldOffset(5)] public byte Byte5; /// /// Get the 6th Byte of the vector /// [FieldOffset(6)] public byte Byte6; /// /// Get the 7th Byte of the vector /// [FieldOffset(7)] public byte Byte7; /// /// Get the 8th Byte of the vector /// [FieldOffset(8)] public byte Byte8; /// /// Get the 9th Byte of the vector /// [FieldOffset(9)] public byte Byte9; /// /// Get the 10th Byte of the vector /// [FieldOffset(10)] public byte Byte10; /// /// Get the 11th Byte of the vector /// [FieldOffset(11)] public byte Byte11; /// /// Get the 12 Byte of the vector /// [FieldOffset(12)] public byte Byte12; /// /// Get the 13th Byte of the vector /// [FieldOffset(13)] public byte Byte13; /// /// Get the 14th Byte of the vector /// [FieldOffset(14)] public byte Byte14; /// /// Get the 15th Byte of the vector /// [FieldOffset(15)] public byte Byte15; /// /// Get the 0th SByte of the vector /// [FieldOffset(0)] public sbyte SByte0; /// /// Get the 1st SByte of the vector /// [FieldOffset(1)] public sbyte SByte1; /// /// Get the 2nd SByte of the vector /// [FieldOffset(2)] public sbyte SByte2; /// /// Get the 3rd SByte of the vector /// [FieldOffset(3)] public sbyte SByte3; /// /// Get the 4th SByte of the vector /// [FieldOffset(4)] public sbyte SByte4; /// /// Get the 5th SByte of the vector /// [FieldOffset(5)] public sbyte SByte5; /// /// Get the 6th SByte of the vector /// [FieldOffset(6)] public sbyte SByte6; /// /// Get the 7th SByte of the vector /// [FieldOffset(7)] public sbyte SByte7; /// /// Get the 8th SByte of the vector /// [FieldOffset(8)] public sbyte SByte8; /// /// Get the 9th SByte of the vector /// [FieldOffset(9)] public sbyte SByte9; /// /// Get the 10th SByte of the vector /// [FieldOffset(10)] public sbyte SByte10; /// /// Get the 11th SByte of the vector /// [FieldOffset(11)] public sbyte SByte11; /// /// Get the 12th SByte of the vector /// [FieldOffset(12)] public sbyte SByte12; /// /// Get the 13th SByte of the vector /// [FieldOffset(13)] public sbyte SByte13; /// /// Get the 14th SByte of the vector /// [FieldOffset(14)] public sbyte SByte14; /// /// Get the 15th SByte of the vector /// [FieldOffset(15)] public sbyte SByte15; /// /// Get the 0th UShort of the vector /// [FieldOffset(0)] public ushort UShort0; /// /// Get the 1st UShort of the vector /// [FieldOffset(2)] public ushort UShort1; /// /// Get the 2nd UShort of the vector /// [FieldOffset(4)] public ushort UShort2; /// /// Get the 3rd UShort of the vector /// [FieldOffset(6)] public ushort UShort3; /// /// Get the 4th UShort of the vector /// [FieldOffset(8)] public ushort UShort4; /// /// Get the 5th UShort of the vector /// [FieldOffset(10)] public ushort UShort5; /// /// Get the 6th UShort of the vector /// [FieldOffset(12)] public ushort UShort6; /// /// Get the 7th UShort of the vector /// [FieldOffset(14)] public ushort UShort7; /// /// Get the 0th SShort of the vector /// [FieldOffset(0)] public short SShort0; /// /// Get the 1st UShort of the vector /// [FieldOffset(2)] public short SShort1; /// /// Get the 2nd UShort of the vector /// [FieldOffset(4)] public short SShort2; /// /// Get the 3rd UShort of the vector /// [FieldOffset(6)] public short SShort3; /// /// Get the 4th UShort of the vector /// [FieldOffset(8)] public short SShort4; /// /// Get the 5th UShort of the vector /// [FieldOffset(10)] public short SShort5; /// /// Get the 6th UShort of the vector /// [FieldOffset(12)] public short SShort6; /// /// Get the 7th UShort of the vector /// [FieldOffset(14)] public short SShort7; #if BURST_INTERNAL || UNITY_BURST_EXPERIMENTAL_NEON_INTRINSICS /// /// Get the 0th f16 of the vector /// [FieldOffset(0)] public f16 Half0; /// /// Get the 1st f16 of the vector /// [FieldOffset(2)] public f16 Half1; /// /// Get the 2nd f16 of the vector /// [FieldOffset(4)] public f16 Half2; /// /// Get the 3rd f16 of the vector /// [FieldOffset(6)] public f16 Half3; /// /// Get the 4th f16 of the vector /// [FieldOffset(8)] public f16 Half4; /// /// Get the 5th f16 of the vector /// [FieldOffset(10)] public f16 Half5; /// /// Get the 6th f16 of the vector /// [FieldOffset(12)] public f16 Half6; /// /// Get the 7th f16 of the vector /// [FieldOffset(14)] public f16 Half7; #endif // BURST_INTERNAL || UNITY_BURST_EXPERIMENTAL_NEON_INTRINSICS /// /// Get the 0th UInt of the vector /// [FieldOffset(0)] public uint UInt0; /// /// Get the 1st UInt of the vector /// [FieldOffset(4)] public uint UInt1; /// /// Get the 2nd UInt of the vector /// [FieldOffset(8)] public uint UInt2; /// /// Get the 3rd UInt of the vector /// [FieldOffset(12)] public uint UInt3; /// /// Get the 0th SInt of the vector /// [FieldOffset(0)] public int SInt0; /// /// Get the 1st SInt of the vector /// [FieldOffset(4)] public int SInt1; /// /// Get the 2nd SInt of the vector /// [FieldOffset(8)] public int SInt2; /// /// Get the 3rd SInt of the vector /// [FieldOffset(12)] public int SInt3; /// /// Get the 0th ULong of the vector /// [FieldOffset(0)] public ulong ULong0; /// /// Get the 1st ULong of the vector /// [FieldOffset(8)] public ulong ULong1; /// /// Get the 0th SLong of the vector /// [FieldOffset(0)] public long SLong0; /// /// Get the 1st SLong of the vector /// [FieldOffset(8)] public long SLong1; /// /// Get the 0th Float of the vector /// [FieldOffset(0)] public float Float0; /// /// Get the 1st Float of the vector /// [FieldOffset(4)] public float Float1; /// /// Get the 2nd Float of the vector /// [FieldOffset(8)] public float Float2; /// /// Get the 3rd Float of the vector /// [FieldOffset(12)] public float Float3; /// /// Get the 0th Double of the vector /// [FieldOffset(0)] public double Double0; /// /// Get the 1st Double of the vector /// [FieldOffset(8)] public double Double1; /// /// Get the low half of the vector /// [FieldOffset(0)] public v64 Lo64; /// /// Get the high half of the vector /// [FieldOffset(8)] public v64 Hi64; /// /// Splat a single byte across the v128 /// /// Splatted byte. public v128(byte b) { this = default(v128); Byte0 = Byte1 = Byte2 = Byte3 = Byte4 = Byte5 = Byte6 = Byte7 = Byte8 = Byte9 = Byte10 = Byte11 = Byte12 = Byte13 = Byte14 = Byte15 = b; } /// /// Initialize the v128 with 16 bytes /// /// byte a. /// byte b. /// byte c. /// byte d. /// byte e. /// byte f. /// byte g. /// byte h. /// byte i. /// byte j. /// byte k. /// byte l. /// byte m. /// byte n. /// byte o. /// byte p. public v128( byte a, byte b, byte c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k, byte l, byte m, byte n, byte o, byte p) { this = default(v128); Byte0 = a; Byte1 = b; Byte2 = c; Byte3 = d; Byte4 = e; Byte5 = f; Byte6 = g; Byte7 = h; Byte8 = i; Byte9 = j; Byte10 = k; Byte11 = l; Byte12 = m; Byte13 = n; Byte14 = o; Byte15 = p; } /// /// Splat a single sbyte across the v128 /// /// Splatted sbyte. public v128(sbyte b) { this = default(v128); SByte0 = SByte1 = SByte2 = SByte3 = SByte4 = SByte5 = SByte6 = SByte7 = SByte8 = SByte9 = SByte10 = SByte11 = SByte12 = SByte13 = SByte14 = SByte15 = b; } /// /// Initialize the v128 with 16 sbytes /// /// sbyte a. /// sbyte b. /// sbyte c. /// sbyte d. /// sbyte e. /// sbyte f. /// sbyte g. /// sbyte h. /// sbyte i. /// sbyte j. /// sbyte k. /// sbyte l. /// sbyte m. /// sbyte n. /// sbyte o. /// sbyte p. public v128( sbyte a, sbyte b, sbyte c, sbyte d, sbyte e, sbyte f, sbyte g, sbyte h, sbyte i, sbyte j, sbyte k, sbyte l, sbyte m, sbyte n, sbyte o, sbyte p) { this = default(v128); SByte0 = a; SByte1 = b; SByte2 = c; SByte3 = d; SByte4 = e; SByte5 = f; SByte6 = g; SByte7 = h; SByte8 = i; SByte9 = j; SByte10 = k; SByte11 = l; SByte12 = m; SByte13 = n; SByte14 = o; SByte15 = p; } /// /// Splat a single short across the v128 /// /// Splatted short. public v128(short v) { this = default(v128); SShort0 = SShort1 = SShort2 = SShort3 = SShort4 = SShort5 = SShort6 = SShort7 = v; } /// /// Initialize the v128 with 8 shorts /// /// short a. /// short b. /// short c. /// short d. /// short e. /// short f. /// short g. /// short h. public v128(short a, short b, short c, short d, short e, short f, short g, short h) { this = default(v128); SShort0 = a; SShort1 = b; SShort2 = c; SShort3 = d; SShort4 = e; SShort5 = f; SShort6 = g; SShort7 = h; } /// /// Splat a single ushort across the v128 /// /// Splatted ushort. public v128(ushort v) { this = default(v128); UShort0 = UShort1 = UShort2 = UShort3 = UShort4 = UShort5 = UShort6 = UShort7 = v; } /// /// Initialize the v128 with 8 ushorts /// /// ushort a. /// ushort b. /// ushort c. /// ushort d. /// ushort e. /// ushort f. /// ushort g. /// ushort h. public v128(ushort a, ushort b, ushort c, ushort d, ushort e, ushort f, ushort g, ushort h) { this = default(v128); UShort0 = a; UShort1 = b; UShort2 = c; UShort3 = d; UShort4 = e; UShort5 = f; UShort6 = g; UShort7 = h; } #if BURST_INTERNAL || UNITY_BURST_EXPERIMENTAL_NEON_INTRINSICS /// /// Splat a single f16 across the v128 /// /// Splatted f16. public v128(f16 v) { this = default(v128); Half0 = Half1 = Half2 = Half3 = Half4 = Half5 = Half6 = Half7 = v; } /// /// Initialize the v128 with 8 half's /// /// f16 a. /// f16 b. /// f16 c. /// f16 d. /// f16 e. /// f16 f. /// f16 g. /// f16 h. public v128(f16 a, f16 b, f16 c, f16 d, f16 e, f16 f, f16 g, f16 h) { this = default(v128); Half0 = a; Half1 = b; Half2 = c; Half3 = d; Half4 = e; Half5 = f; Half6 = g; Half7 = h; } #endif // BURST_INTERNAL || UNITY_BURST_EXPERIMENTAL_NEON_INTRINSICS /// /// Splat a single int across the v128 /// /// Splatted int. public v128(int v) { this = default(v128); SInt0 = SInt1 = SInt2 = SInt3 = v; } /// /// Initialize the v128 with 4 ints /// /// int a. /// int b. /// int c. /// int d. public v128(int a, int b, int c, int d) { this = default(v128); SInt0 = a; SInt1 = b; SInt2 = c; SInt3 = d; } /// /// Splat a single uint across the v128 /// /// Splatted uint. public v128(uint v) { this = default(v128); UInt0 = UInt1 = UInt2 = UInt3 = v; } /// /// Initialize the v128 with 4 uints /// /// uint a. /// uint b. /// uint c. /// uint d. public v128(uint a, uint b, uint c, uint d) { this = default(v128); UInt0 = a; UInt1 = b; UInt2 = c; UInt3 = d; } /// /// Splat a single float across the v128 /// /// Splatted float. public v128(float f) { this = default(v128); Float0 = Float1 = Float2 = Float3 = f; } /// /// Initialize the v128 with 4 floats /// /// float a. /// float b. /// float c. /// float d. public v128(float a, float b, float c, float d) { this = default(v128); Float0 = a; Float1 = b; Float2 = c; Float3 = d; } /// /// Splat a single double across the v128 /// /// Splatted double. public v128(double f) { this = default(v128); Double0 = Double1 = f; } /// /// Initialize the v128 with 2 doubles /// /// double a. /// double b. public v128(double a, double b) { this = default(v128); Double0 = a; Double1 = b; } /// /// Splat a single long across the v128 /// /// Splatted long. public v128(long f) { this = default(v128); SLong0 = SLong1 = f; } /// /// Initialize the v128 with 2 longs /// /// long a. /// long b. public v128(long a, long b) { this = default(v128); SLong0 = a; SLong1 = b; } /// /// Splat a single ulong across the v128 /// /// Splatted ulong. public v128(ulong f) { this = default(v128); ULong0 = ULong1 = f; } /// /// Initialize the v128 with 2 ulongs /// /// ulong a. /// ulong b. public v128(ulong a, ulong b) { this = default(v128); ULong0 = a; ULong1 = b; } /// /// Initialize the v128 with 2 v64's /// /// Low half of v64. /// High half of v64. public v128(v64 lo, v64 hi) { this = default(v128); Lo64 = lo; Hi64 = hi; } } #if BURST_INTERNAL || UNITY_BURST_EXPERIMENTAL_NEON_INTRINSICS /// /// Represents a 256-bit SIMD value (Arm only) /// (a combination of 2 128-bit values, equivalent to Arm Neon *x2 types) /// [StructLayout(LayoutKind.Explicit)] public struct v128x2 { /// /// Get the first 128 bits of the vector /// [FieldOffset(0)] public v128 v128_0; /// /// Get the second 128 bits of the vector /// [FieldOffset(16)] public v128 v128_1; /// /// Initialize the v128x2 with 2 v128's /// /// First v128. /// Second v128. public v128x2(v128 v0, v128 v1) { this = default(v128x2); v128_0 = v0; v128_1 = v1; } } /// /// Represents a 384-bit SIMD value (Arm only) /// (a combination of 3 128-bit values, equivalent to Arm Neon *x3 types) /// [StructLayout(LayoutKind.Explicit)] public struct v128x3 { /// /// Get the first 128 bits of the vector /// [FieldOffset(0)] public v128 v128_0; /// /// Get the second 128 bits of the vector /// [FieldOffset(16)] public v128 v128_1; /// /// Get the third 128 bits of the vector /// [FieldOffset(32)] public v128 v128_2; /// /// Initialize the v128x3 with 3 v128's /// /// First v128. /// Second v128. /// Third v128. public v128x3(v128 v0, v128 v1, v128 v2) { this = default(v128x3); v128_0 = v0; v128_1 = v1; v128_2 = v2; } } /// /// Represents a 512-bit SIMD value (Arm only) /// (a combination of 4 128-bit values, equivalent to Arm Neon *x4 types) /// [StructLayout(LayoutKind.Explicit)] public struct v128x4 { /// /// Get the first 128 bits of the vector /// [FieldOffset(0)] public v128 v128_0; /// /// Get the second 128 bits of the vector /// [FieldOffset(16)] public v128 v128_1; /// /// Get the third 128 bits of the vector /// [FieldOffset(32)] public v128 v128_2; /// /// Get the fourth 128 bits of the vector /// [FieldOffset(48)] public v128 v128_3; /// /// Initialize the v128x4 with 4 v128's /// /// First v128. /// Second v128. /// Third v128. /// Fourth v128. public v128x4(v128 v0, v128 v1, v128 v2, v128 v3) { this = default(v128x4); v128_0 = v0; v128_1 = v1; v128_2 = v2; v128_3 = v3; } } #endif // BURST_INTERNAL || UNITY_BURST_EXPERIMENTAL_NEON_INTRINSICS }