Esempio n. 1
0
        public void RunLclVarScenario_LoadAligned()
        {
            var firstOp = Sse2.LoadAlignedVector128((Double *)(_dataTable.inArrayPtr));
            var result  = Avx.Permute(firstOp, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(firstOp, _dataTable.outArrayPtr);
        }
Esempio n. 2
0
        public void RunStructLclFldScenario()
        {
            var test   = TestStruct.Create();
            var result = Avx.Permute(test._fld, 1);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(test._fld, _dataTable.outArrayPtr);
        }
Esempio n. 3
0
        public void RunLclVarScenario_UnsafeRead()
        {
            var firstOp = Unsafe.Read <Vector128 <Double> >(_dataTable.inArrayPtr);
            var result  = Avx.Permute(firstOp, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(firstOp, _dataTable.outArrayPtr);
        }
Esempio n. 4
0
        public void RunClassLclFldScenario()
        {
            var test   = new ImmUnaryOpTest__PermuteSingle1();
            var result = Avx.Permute(test._fld, 1);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(test._fld, _dataTable.outArrayPtr);
        }
Esempio n. 5
0
        public void RunLclVarScenario_Load()
        {
            var firstOp = Avx.LoadVector256((Single *)(_dataTable.inArrayPtr));
            var result  = Avx.Permute(firstOp, 1);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(firstOp, _dataTable.outArrayPtr);
        }
Esempio n. 6
0
        public void RunLclFldScenario()
        {
            var test   = new SimpleUnaryOpTest__PermuteDouble2();
            var result = Avx.Permute(test._fld, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(test._fld, _dataTable.outArrayPtr);
        }
Esempio n. 7
0
        public static Vector128 <float> Shuffle(Vector128 <float> vector, byte control)
        {
            if (Avx.IsSupported)
            {
                return(Avx.Permute(vector, control));
            }

            return(Shuffle(vector, vector, control));
        }
Esempio n. 8
0
        public void RunClassFldScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));

            var result = Avx.Permute(_fld, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_fld, _dataTable.outArrayPtr);
        }
Esempio n. 9
0
        public static Vector256 <double> Permute(Vector4DParam1_3 vector, byte control)
        {
            if (Avx.IsSupported)
            {
                return(Avx.Permute(vector, control));
            }

            return(Shuffle(vector, vector, control));
        }
        public void RunLclVarScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));

            var firstOp = Avx.LoadVector256((Single *)(_dataTable.inArrayPtr));
            var result  = Avx.Permute(firstOp, 1);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(firstOp, _dataTable.outArrayPtr);
        }
Esempio n. 11
0
        public void RunClsVarScenario()
        {
            var result = Avx.Permute(
                _clsVar,
                1
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_clsVar, _dataTable.outArrayPtr);
        }
Esempio n. 12
0
        public void RunBasicScenario_LoadAligned()
        {
            var result = Avx.Permute(
                Avx.LoadAlignedVector256((Single *)(_dataTable.inArrayPtr)),
                1
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
        }
Esempio n. 13
0
        public void RunStructLclFldScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));

            var test   = TestStruct.Create();
            var result = Avx.Permute(test._fld, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(test._fld, _dataTable.outArrayPtr);
        }
Esempio n. 14
0
        public void RunBasicScenario_UnsafeRead()
        {
            var result = Avx.Permute(
                Unsafe.Read <Vector256 <Single> >(_dataTable.inArrayPtr),
                1
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
        }
Esempio n. 15
0
        public void RunClassLclFldScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));

            var test   = new ImmUnaryOpTest__PermuteDouble2();
            var result = Avx.Permute(test._fld, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(test._fld, _dataTable.outArrayPtr);
        }
Esempio n. 16
0
        public void RunLclVarScenario_UnsafeRead()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));

            var firstOp = Unsafe.Read <Vector128 <Double> >(_dataTable.inArrayPtr);
            var result  = Avx.Permute(firstOp, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(firstOp, _dataTable.outArrayPtr);
        }
Esempio n. 17
0
        public void RunLclVarScenario_LoadAligned()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));

            var firstOp = Sse2.LoadAlignedVector128((Double *)(_dataTable.inArrayPtr));
            var result  = Avx.Permute(firstOp, 2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(firstOp, _dataTable.outArrayPtr);
        }
Esempio n. 18
0
        public void RunBasicScenario_Load()
        {
            var result = Avx.Permute(
                Sse.LoadVector128((Single *)(_dataTable.inArrayPtr)),
                2
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
        }
Esempio n. 19
0
        public void RunBasicScenario_UnsafeRead()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));

            var result = Avx.Permute(
                Unsafe.Read <Vector256 <Double> >(_dataTable.inArrayPtr),
                1
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
        }
Esempio n. 20
0
        public void RunBasicScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));

            var result = Avx.Permute(
                Sse2.LoadVector128((Double *)(_dataTable.inArrayPtr)),
                2
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
        }
        public void RunBasicScenario_LoadAligned()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));

            var result = Avx.Permute(
                Avx.LoadAlignedVector256((Single *)(_dataTable.inArrayPtr)),
                1
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
        }
Esempio n. 22
0
        private static float ReduceMax(Vector256 <float> vector)
        {
            Vector128 <float> hi128 = Avx.ExtractVector128(vector, 1);
            Vector128 <float> lo128 = Avx.ExtractVector128(vector, 0);

            Vector128 <float> hiTmp1 = Avx.Permute(hi128, 0x1b);
            Vector128 <float> hiTmp2 = Avx.Permute(hi128, 0x4e);

            Vector128 <float> loTmp1 = Avx.Permute(lo128, 0x1b);
            Vector128 <float> loTmp2 = Avx.Permute(lo128, 0x4e);

            hi128 = Sse.Max(hi128, hiTmp1);
            hi128 = Sse.Max(hi128, hiTmp2);

            lo128 = Sse.Max(lo128, loTmp1);
            lo128 = Sse.Max(lo128, loTmp2);

            lo128 = Sse.Max(lo128, hi128);

            return(Sse.ConvertToSingle(lo128));
        }
Esempio n. 23
0
        public static void Rotate180_Avx(NativeImage <float> src, NativeImage <float> dst)
        {
            var w8 = src.Width / 8 * 8;

            for (var j = 0; j < src.Height; j++)
            {
                var s = src.PixelAddr(0, j);
                var d = dst.PixelAddr(src.Width, j);

                for (var i = 0; i < w8; i += 8)
                {
                    var v = Avx.Permute(Avx.LoadAlignedVector256(s), 0x1b);
                    s += 8;
                    d -= 8;
                    Avx.Store(d, Avx.Permute2x128(v, v, 1));
                }

                for (var i = w8; i < src.Width; i++)
                {
                    *--d = *s++;
                }
            }
        }
Esempio n. 24
0
        private static double MinMaxCore(Vector <double> vector, bool doMin)
        {
            Vector256 <double> vec256 = Unsafe.As <Vector <double>, Vector256 <double> >(ref vector);
            Vector128 <double> hi128  = vec256.GetUpper();
            Vector128 <double> lo128  = vec256.GetLower();
            Vector128 <double> tmp1   = Avx.Permute(hi128, 0b_01);
            Vector128 <double> tmp2   = Avx.Permute(lo128, 0b_01);

            if (doMin)
            {
                hi128 = Sse2.Min(hi128, tmp1);
                lo128 = Sse2.Min(lo128, tmp2);
                lo128 = Sse2.Min(lo128, hi128);
            }
            else
            {
                hi128 = Sse2.Max(hi128, tmp1);
                lo128 = Sse2.Max(lo128, tmp2);
                lo128 = Sse2.Max(lo128, hi128);
            }

            return(lo128.ToScalar());
        }