Exemplo n.º 1
0
        public static unsafe Vector8s ShuffleLow(Vector8s va, ShuffleSel sel)
        {
            short *ptr = ((short *)&va);
            int    idx = (int)sel;

            return(new Vector8s(*(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3)), va.v4, va.v5, va.v6, va.v7));
        }
Exemplo n.º 2
0
        public static unsafe Vector8s ShuffleHigh(Vector8s va, ShuffleSel sel)
        {
            short *ptr = ((short *)&va) + 4;
            int    idx = (int)sel;

            return(new Vector8s(va.v0, va.v1, va.v2, va.v3, *(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3))));
        }
Exemplo n.º 3
0
		public static unsafe Vector8s operator * (Vector8s va, Vector8s vb)
		{
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short)(*a++ * (*b++));
			return res;
		}
Exemplo n.º 4
0
        public static unsafe int ExtractByteMask(Vector8s va)
        {
            int   res = 0;
            byte *a   = (byte *)&va;

            for (int i = 0; i < 16; ++i)
            {
                res |= (*a++ & 0x80) >> 7 << i;
            }
            return(res);
        }
Exemplo n.º 5
0
 public static void SetVectorAligned(this short[] array, Vector8s val, int offset)
 {
     array [offset + 0] = val.V0;
     array [offset + 1] = val.V1;
     array [offset + 2] = val.V2;
     array [offset + 3] = val.V3;
     array [offset + 4] = val.V4;
     array [offset + 5] = val.V5;
     array [offset + 6] = val.V6;
     array [offset + 7] = val.V7;
 }
Exemplo n.º 6
0
        public static unsafe Vector8s ShiftRightLogic(Vector8s va, int amount)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *b++ = (short)((ushort)(*a++) >> amount);
            }
            return(res);
        }
Exemplo n.º 7
0
        public static unsafe Vector8s operator <<(Vector8s va, int amount)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *b++ = (short)(*a++ << amount);
            }
            return(res);
        }
Exemplo n.º 8
0
        public static unsafe Vector8s Min(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)System.Math.Min(*a++, *b++);
            }
            return(res);
        }
Exemplo n.º 9
0
        public static unsafe Vector8s AddWithSaturation(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)System.Math.Max(System.Math.Min(*a++ + *b++, short.MaxValue), short.MinValue);
            }
            return(res);
        }
Exemplo n.º 10
0
        public static unsafe Vector8s operator ^(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            uint *   a   = (uint *)&va.v0;
            uint *   b   = (uint *)&vb.v0;
            uint *   c   = (uint *)&res.v0;

            *c++ = *a++ ^ *b++;
            *c++ = *a++ ^ *b++;
            *c++ = *a++ ^ *b++;
            *c   = *a ^ *b;
            return(res);
        }
Exemplo n.º 11
0
        public static unsafe Vector8s CompareGreaterThan(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)(*a++ > *b++ ? -1 : 0);
            }
            return(res);
        }
Exemplo n.º 12
0
        public static unsafe Vector8s MultiplyStoreHigh(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)((int)*a++ *(int)*b++ >> 16);
            }
            return(res);
        }
Exemplo n.º 13
0
        public static unsafe Vector8s operator *(Vector8s va, Vector8s vb)
        {
            Vector8s res = new Vector8s();
            short *  a   = &va.v0;
            short *  b   = &vb.v0;
            short *  c   = &res.v0;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (short)(*a++ *(*b++));
            }
            return(res);
        }
Exemplo n.º 14
0
        public static unsafe Vector16sb PackWithSignedSaturation(Vector8s va, Vector8s vb)
        {
            Vector16sb res = new Vector16sb();
            short *    a   = (short *)&va;
            short *    b   = (short *)&vb;
            sbyte *    c   = (sbyte *)&res;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (sbyte)System.Math.Max(System.Math.Min((int)*a++, sbyte.MaxValue), sbyte.MinValue);
            }
            for (int i = 0; i < 8; ++i)
            {
                *c++ = (sbyte)System.Math.Max(System.Math.Min((int)*b++, sbyte.MaxValue), sbyte.MinValue);
            }
            return(res);
        }
Exemplo n.º 15
0
        public static unsafe Vector16b PackWithUnsignedSaturation(this Vector8s va, Vector8s vb)
        {
            Vector16b res = new Vector16b();
            short *   a   = (short *)&va;
            short *   b   = (short *)&vb;
            byte *    c   = (byte *)&res;

            for (int i = 0; i < 8; ++i)
            {
                *c++ = (byte)System.Math.Max(0, System.Math.Min((int)*a++, byte.MaxValue));
            }
            for (int i = 0; i < 8; ++i)
            {
                *c++ = (byte)System.Math.Max(0, System.Math.Min((int)*b++, byte.MaxValue));
            }
            return(res);
        }
Exemplo n.º 16
0
        public static unsafe Vector8s SignedPackWithSignedSaturation(Vector4ui va, Vector4ui vb)
        {
            Vector8s res = new Vector8s();
            int *    a   = (int *)&va;
            int *    b   = (int *)&vb;
            short *  c   = (short *)&res;

            for (int i = 0; i < 4; ++i)
            {
                *c++ = (short)System.Math.Max(System.Math.Min((int)*a++, short.MaxValue), short.MinValue);
            }
            for (int i = 0; i < 4; ++i)
            {
                *c++ = (short)System.Math.Max(System.Math.Min((int)*b++, short.MaxValue), short.MinValue);
            }
            return(res);
        }
Exemplo n.º 17
0
	public static int test_0_sse41_vector8s_min () {
		Vector8s v = new Vector8s(2);
		Vector8s v2 = new Vector8s(1);
		v = v.Min(v2);
		if (v.V0 != 1 || v.V1 != 1 || v.V2 != 1 || v.V3 != 1 || v.V4 != 1 || v.V5 != 1 || v.V6 != 1 || v.V7 != 1)
			return 1;
		return 0;
	}
Exemplo n.º 18
0
 public static unsafe void StoreAligned(Vector8s *res, Vector8s val)
 {
     *res = val;
 }
Exemplo n.º 19
0
		public static unsafe Vector8s SubtractWithSaturation (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short) System.Math.Max (System.Math.Min (*a++ - *b++, short.MaxValue), short.MinValue); ;
			return res;
		}
Exemplo n.º 20
0
		public static unsafe Vector16sb PackWithSignedSaturation (this Vector8s va, Vector8s vb) {
			Vector16sb res = new Vector16sb ();
			short *a = (short*)&va;
			short *b = (short*)&vb;
			sbyte *c = (sbyte*)&res;
			for (int i = 0; i < 8; ++i)
				*c++ = (sbyte)System.Math.Max (System.Math.Min ((int)*a++, sbyte.MaxValue), sbyte.MinValue);
			for (int i = 0; i < 8; ++i)
				*c++ = (sbyte)System.Math.Max (System.Math.Min ((int)*b++, sbyte.MaxValue), sbyte.MinValue);
			return res;
		}
Exemplo n.º 21
0
		public static unsafe Vector8s operator >> (Vector8s va, int amount)
		{
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &res.v0;
			for (int i = 0; i < 8; ++i)
				*b++ = (short)(*a++ >> amount);
			return res;
		}
Exemplo n.º 22
0
		public static unsafe void PrefetchNonTemporal (Vector8s *res)
		{
		}
Exemplo n.º 23
0
		public static unsafe void PrefetchTemporalAllCacheLevels (Vector8s *res)
		{
		}
Exemplo n.º 24
0
		public static unsafe Vector8s ShuffleHigh (Vector8s va, ShuffleSel sel)
		{
			short *ptr = ((short*)&va) + 4;
			int idx = (int)sel;
			return new Vector8s (va.v0, va.v1, va.v2, va.v3, *(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3)));
		}
Exemplo n.º 25
0
		public static unsafe int ExtractByteMask (Vector8s va) {
			int res = 0;
			byte *a = (byte*)&va;
			for (int i = 0; i < 16; ++i)
				res |= (*a++ & 0x80) >> 7 << i;
			return res;
		}
Exemplo n.º 26
0
 public static void PrefetchNonTemporal(ref Vector8s res)
 {
 }
Exemplo n.º 27
0
 public static void PrefetchTemporal2ndLevelCache(ref Vector8s res)
 {
 }
Exemplo n.º 28
0
 public static void PrefetchTemporalAllCacheLevels(ref Vector8s res)
 {
 }
Exemplo n.º 29
0
		public static unsafe Vector8s operator ^ (Vector8s va, Vector8s vb)
		{
			Vector8s res = new Vector8s ();
			uint *a = (uint*) &va.v0;
			uint *b = (uint*) &vb.v0;
			uint *c = (uint*) &res.v0;
			*c++ = *a++ ^ *b++;
			*c++ = *a++ ^ *b++;
			*c++ = *a++ ^ *b++;
			*c = *a ^ *b;
			return res;
		}
Exemplo n.º 30
0
		public static unsafe Vector8s ShuffleLow (Vector8s va, ShuffleSel sel)
		{
			short *ptr = ((short*)&va);
			int idx = (int)sel;
			return new Vector8s (*(ptr + ((idx >> 0) & 0x3)), *(ptr + ((idx >> 2) & 0x3)), *(ptr + ((idx >> 4) & 0x3)), *(ptr + ((idx >> 6) & 0x3)), va.v4, va.v5, va.v6, va.v7);
		}
Exemplo n.º 31
0
 public static Vector8s LoadAligned(ref Vector8s v)
 {
     return(v);
 }
Exemplo n.º 32
0
		public static unsafe Vector16b PackWithUnsignedSaturation (Vector8s va, Vector8s vb) {
			Vector16b res = new Vector16b ();
			short *a = (short*)&va;
			short *b = (short*)&vb;
			byte *c = (byte*)&res;
			for (int i = 0; i < 8; ++i)
				*c++ = (byte)System.Math.Max (0, System.Math.Min ((int)*a++, byte.MaxValue));
			for (int i = 0; i < 8; ++i)
				*c++ = (byte)System.Math.Max (0, System.Math.Min ((int)*b++, byte.MaxValue));
			return res;
		}
Exemplo n.º 33
0
		public static unsafe void PrefetchTemporal2ndLevelCache (Vector8s *res)
		{
		}
Exemplo n.º 34
0
		public static Vector8s LoadAligned (ref Vector8s v)
		{
			return v;
		}
Exemplo n.º 35
0
 public static unsafe Vector8s UnpackLow(Vector8s va, Vector8s vb)
 {
     return(new Vector8s(va.v0, vb.v0, va.v1, vb.v1, va.v2, vb.v2, va.v3, vb.v3));
 }
Exemplo n.º 36
0
		public static unsafe Vector8s Min (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short) System.Math.Min (*a++, *b++);
			return res;
		}
Exemplo n.º 37
0
		public static unsafe Vector8s LogicalRightShift (this Vector8s va, int amount)
		{
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &res.v0;
			for (int i = 0; i < 8; ++i)
				*b++ = (short)((ushort)(*a++) >> amount);
			return res;
		}
Exemplo n.º 38
0
		public static unsafe Vector8s UnpackLow (this Vector8s va, Vector8s vb)
		{
			return new Vector8s (va.v0, vb.v0, va.v1, vb.v1, va.v2, vb.v2, va.v3, vb.v3);
		}
Exemplo n.º 39
0
		public static unsafe Vector8s SignedPackWithSignedSaturation (this Vector4ui va, Vector4ui vb) {
			Vector8s res = new Vector8s ();
			int *a = (int*)&va;
			int *b = (int*)&vb;
			short *c = (short*)&res;
			for (int i = 0; i < 4; ++i)
				*c++ = (short)System.Math.Max (System.Math.Min ((int)*a++, short.MaxValue), short.MinValue);
			for (int i = 0; i < 4; ++i)
				*c++ = (short)System.Math.Max (System.Math.Min ((int)*b++, short.MaxValue), short.MinValue);
			return res;
		}
Exemplo n.º 40
0
	public static unsafe int test_0_vector8s_pack_signed_sat () {
		Vector8s a = new Vector8s (-200, 200, 3, 0, 5, 6, 5, 4);
		Vector8s b = new Vector8s (9, 2, 1, 2, 3, 6, 5, 6);

		Vector16sb c = a.PackWithSignedSaturation (b);

		if (c.V0 != -128)
			return 1;
		if (c.V1 != 127)
			return 2;

		return 0;
	}
Exemplo n.º 41
0
		public static unsafe Vector8s MultiplyStoreHigh (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short)((int)*a++ * (int)*b++ >> 16);
			return res;
		}
Exemplo n.º 42
0
 public static void StoreAligned(ref Vector8s res, Vector8s val)
 {
     res = val;
 }
Exemplo n.º 43
0
		public static unsafe Vector8s CompareGreaterThan (this Vector8s va, Vector8s vb) {
			Vector8s res = new Vector8s ();
			short *a = &va.v0;
			short *b = &vb.v0;
			short *c = &res.v0;
			for (int i = 0; i < 8; ++i)
				*c++ = (short) (*a++ > *b++ ? -1 : 0);
			return res;
		}
Exemplo n.º 44
0
		public static unsafe Vector8s LoadAligned (Vector8s *v)
		{
			return *v;
		}
Exemplo n.º 45
0
		public static unsafe Vector8s UnpackHigh (this Vector8s va, Vector8s vb)
		{
			return new Vector8s (va.v4, vb.v4, va.v5, vb.v5, va.v6, vb.v6, va.v7, vb.v7);
		}
Exemplo n.º 46
0
		public static unsafe void StoreAligned (Vector8s *res, Vector8s val)
		{
			*res = val;
		}
Exemplo n.º 47
0
	static int test_0_vector8s_one_element_ctor () {
		Vector8s a = new Vector8s (99);

		if (a.V0 != 99)
			return 1;
		if (a.V1 != 99)
			return 2;
		if (a.V2 != 99)
			return 3;
		if (a.V3 != 99)
			return 4;
		if (a.V4 != 99)
			return 5;
		if (a.V5 != 99)
			return 6;
		if (a.V6 != 99)
			return 7;
		if (a.V7 != 99)
			return 8;
		return 0;
	}
Exemplo n.º 48
0
		public static void PrefetchTemporalAllCacheLevels (ref Vector8s res)
		{
		}
Exemplo n.º 49
0
		public static void PrefetchTemporal2ndLevelCache (ref Vector8s res)
		{
		}
Exemplo n.º 50
0
		public static void PrefetchNonTemporal (ref Vector8s res)
		{
		}
Exemplo n.º 51
0
		public static void StoreAligned (ref Vector8s res, Vector8s val)
		{
			res = val;
		}
Exemplo n.º 52
0
 public static unsafe Vector8s UnpackHigh(Vector8s va, Vector8s vb)
 {
     return(new Vector8s(va.v4, vb.v4, va.v5, vb.v5, va.v6, vb.v6, va.v7, vb.v7));
 }