[msbuild] Getting build error "Error initializing task XmlPeek: Not registered task...
[mono.git] / mcs / class / Mono.Simd / Mono.Simd / VectorOperations.cs
index 5111c15e4470931629a9703d43929cc4b1f61cad..0886b075a884183d1c7967f6701cc8c1585e838c 100644 (file)
@@ -961,6 +961,57 @@ namespace Mono.Simd
                        return new Vector16b (va.v8, vb.v8, va.v9, vb.v9, va.v10, vb.v10, va.v11, vb.v11, va.v12, vb.v12, va.v13, vb.v13, va.v14, vb.v14, va.v15, vb.v15);
                }
 
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4f Shuffle (this Vector4f v1, Vector4f v2, ShuffleSel sel)
+               {
+                       float *p1 = (float*)&v1;
+                       float *p2 = (float*)&v2;
+                       int idx = (int)sel;
+                       return new Vector4f (*(p1 + ((idx >> 0) & 0x3)), *(p1 + ((idx >> 2) & 0x3)), *(p2 + ((idx >> 4) & 0x3)), *(p2 + ((idx >> 6) & 0x3))); 
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4i Shuffle (this Vector4i v1, Vector4i v2, ShuffleSel sel)
+               {
+                       int *p1 = (int*)&v1;
+                       int *p2 = (int*)&v2;
+                       int idx = (int)sel;
+                       return new Vector4i (*(p1 + ((idx >> 0) & 0x3)), *(p1 + ((idx >> 2) & 0x3)), *(p2 + ((idx >> 4) & 0x3)), *(p2 + ((idx >> 6) & 0x3))); 
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4ui Shuffle (this Vector4ui v1, Vector4ui v2, ShuffleSel sel)
+               {
+                       uint *p1 = (uint*)&v1;
+                       uint *p2 = (uint*)&v2;
+                       int idx = (int)sel;
+                       return new Vector4ui (*(p1 + ((idx >> 0) & 0x3)), *(p1 + ((idx >> 2) & 0x3)), *(p2 + ((idx >> 4) & 0x3)), *(p2 + ((idx >> 6) & 0x3))); 
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector2d Shuffle (this Vector2d v1, Vector2d v2, int sel)
+               {
+                       double *p1 = (double*)&v1;
+                       double *p2 = (double*)&v2;
+                       return new Vector2d (*(p1 + ((sel >> 0) & 0x1)), *(p2 + ((sel >> 1) & 0x1))); 
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector2l Shuffle (this Vector2l v1, Vector2l v2, int sel)
+               {
+                       long *p1 = (long*)&v1;
+                       long *p2 = (long*)&v2;
+                       return new Vector2l (*(p1 + ((sel >> 0) & 0x1)), *(p2 + ((sel >> 1) & 0x1)));
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector2ul Shuffle (this Vector2ul v1, Vector2ul v2, int sel)
+               {
+                       ulong *p1 = (ulong*)&v1;
+                       ulong *p2 = (ulong*)&v2;
+                       return new Vector2ul (*(p1 + ((sel >> 0) & 0x1)), *(p2 + ((sel >> 1) & 0x1))); 
+               }
+
                [Acceleration (AccelMode.SSE2)]
                public static unsafe Vector4f Shuffle (this Vector4f v1, ShuffleSel sel)
                {
@@ -1134,5 +1185,45 @@ namespace Mono.Simd
                                *c++ = (sbyte)System.Math.Max (System.Math.Min ((int)*b++, sbyte.MaxValue), sbyte.MinValue);
                        return res;
                }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4f ConvertToFloat (this Vector4i v0) {
+                       return new Vector4f (v0.X, v0.Y, v0.Z, v0.W);
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector2d ConvertToDouble (this Vector4i v0) {
+                       return new Vector2d (v0.X, v0.Y);
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4i ConvertToInt (this Vector2d v0) {
+                       return new Vector4i ((int)System.Math.Round (v0.X), (int)System.Math.Round (v0.Y), 0, 0);
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4i ConvertToIntTruncated (this Vector2d v0) {
+                       return new Vector4i ((int) (v0.X), (int) (v0.Y), 0, 0);
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4f ConvertToFloat (this Vector2d v0) {
+                       return new Vector4f ((float)v0.X, (float)v0.Y, 0, 0);
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4i ConvertToInt (this Vector4f v0) {
+                       return new Vector4i ((int)System.Math.Round (v0.X), (int)System.Math.Round (v0.Y), (int)System.Math.Round (v0.Z), (int)System.Math.Round (v0.W));
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector4i ConvertToIntTruncated (this Vector4f v0) {
+                       return new Vector4i ((int)v0.X, (int)v0.Y, (int)v0.Z, (int)v0.W);
+               }
+
+               [Acceleration (AccelMode.SSE2)]
+               public static unsafe Vector2d ConvertToDouble (this Vector4f v0) {
+                       return new Vector2d (v0.X, v0.Y);
+               }
        }
 }