public void RunLclVarScenario_UnsafeRead()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));

            var op1    = Unsafe.Read <Vector128 <Byte> >(_dataTable.inArray1Ptr);
            var op2    = Unsafe.Read <Vector128 <Byte> >(_dataTable.inArray2Ptr);
            var result = AdvSimd.CompareGreaterThan(op1, op2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(op1, op2, _dataTable.outArrayPtr);
        }
Exemplo n.º 2
0
        public void RunLclVarScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));

            var op1    = AdvSimd.LoadVector64((Int32 *)(_dataTable.inArray1Ptr));
            var op2    = AdvSimd.LoadVector64((Int32 *)(_dataTable.inArray2Ptr));
            var result = AdvSimd.CompareGreaterThan(op1, op2);

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(op1, op2, _dataTable.outArrayPtr);
        }
        public void RunClsVarScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));

            var result = AdvSimd.CompareGreaterThan(
                _clsVar1,
                _clsVar2
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
        }
        public void RunBasicScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));

            var result = AdvSimd.CompareGreaterThan(
                AdvSimd.LoadVector64((Single *)(_dataTable.inArray1Ptr)),
                AdvSimd.LoadVector64((Single *)(_dataTable.inArray2Ptr))
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
        }
        public void RunBasicScenario_UnsafeRead()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));

            var result = AdvSimd.CompareGreaterThan(
                Unsafe.Read <Vector128 <Single> >(_dataTable.inArray1Ptr),
                Unsafe.Read <Vector128 <Single> >(_dataTable.inArray2Ptr)
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
        }
        public void RunStructLclFldScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));

            var test   = TestStruct.Create();
            var result = AdvSimd.CompareGreaterThan(
                AdvSimd.LoadVector64((Single *)(&test._fld1)),
                AdvSimd.LoadVector64((Single *)(&test._fld2))
                );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
        }
            public void RunStructFldScenario_Load(SimpleBinaryOpTest__CompareGreaterThan_Vector64_Single testClass)
            {
                fixed(Vector64 <Single> *pFld1 = &_fld1)
                fixed(Vector64 <Single> *pFld2 = &_fld2)
                {
                    var result = AdvSimd.CompareGreaterThan(
                        AdvSimd.LoadVector64((Single *)(pFld1)),
                        AdvSimd.LoadVector64((Single *)(pFld2))
                        );

                    Unsafe.Write(testClass._dataTable.outArrayPtr, result);
                    testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
                }
            }
        public void RunClassFldScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));

            fixed(Vector64 <Single> *pFld1 = &_fld1)
            fixed(Vector64 <Single> *pFld2 = &_fld2)
            {
                var result = AdvSimd.CompareGreaterThan(
                    AdvSimd.LoadVector64((Single *)(pFld1)),
                    AdvSimd.LoadVector64((Single *)(pFld2))
                    );

                Unsafe.Write(_dataTable.outArrayPtr, result);
                ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
            }
        }
        public void RunClsVarScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));

            fixed(Vector128 <Single> *pClsVar1 = &_clsVar1)
            fixed(Vector128 <Single> *pClsVar2 = &_clsVar2)
            {
                var result = AdvSimd.CompareGreaterThan(
                    AdvSimd.LoadVector128((Single *)(pClsVar1)),
                    AdvSimd.LoadVector128((Single *)(pClsVar2))
                    );

                Unsafe.Write(_dataTable.outArrayPtr, result);
                ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
            }
        }
Exemplo n.º 10
0
        public static Vector128 <short> CreateAsciiMask(Vector128 <short> sourceValue)
        {
            if (!AdvSimd.Arm64.IsSupported)
            {
                throw new PlatformNotSupportedException();
            }

            // Anything above short.MaxValue but less than or equal char.MaxValue
            // That's because anything between 32768 and 65535 (inclusive) will overflow and become negative.
            Vector128 <short> mask = AdvSimd.CompareLessThan(sourceValue, s_nullMaskInt16);

            // Anything above the ASCII range
            mask = AdvSimd.Or(mask, AdvSimd.CompareGreaterThan(sourceValue, s_maxAsciiCharacterMaskInt16));

            return(mask);
        }
        public void RunClassLclFldScenario_Load()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));

            var test = new SimpleBinaryOpTest__CompareGreaterThan_Vector128_Single();

            fixed(Vector128 <Single> *pFld1 = &test._fld1)
            fixed(Vector128 <Single> *pFld2 = &test._fld2)
            {
                var result = AdvSimd.CompareGreaterThan(
                    AdvSimd.LoadVector128((Single *)(pFld1)),
                    AdvSimd.LoadVector128((Single *)(pFld2))
                    );

                Unsafe.Write(_dataTable.outArrayPtr, result);
                ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
            }
        }
Exemplo n.º 12
0
        public static Vector128 <sbyte> CreateEscapingMask_UnsafeRelaxedJavaScriptEncoder(Vector128 <sbyte> sourceValue)
        {
            if (!AdvSimd.Arm64.IsSupported)
            {
                throw new PlatformNotSupportedException();
            }

            // Anything in the control characters range (except 0x7F), and anything above sbyte.MaxValue but less than or equal byte.MaxValue
            // That's because anything between 128 and 255 (inclusive) will overflow and become negative.
            Vector128 <sbyte> mask = AdvSimd.CompareLessThan(sourceValue, s_spaceMaskSByte);

            mask = AdvSimd.Or(mask, AdvSimd.CompareEqual(sourceValue, s_quotationMarkMaskSByte));
            mask = AdvSimd.Or(mask, AdvSimd.CompareEqual(sourceValue, s_reverseSolidusMaskSByte));

            // Leftover control character in the ASCII range - 0x7F
            // Since we are dealing with sbytes, 0x7F is the only value that would meet this comparison.
            mask = AdvSimd.Or(mask, AdvSimd.CompareGreaterThan(sourceValue, s_tildeMaskSByte));

            return(mask);
        }
Exemplo n.º 13
0
        public static Vector128 <short> CreateEscapingMask_UnsafeRelaxedJavaScriptEncoder(Vector128 <short> sourceValue)
        {
            if (!AdvSimd.Arm64.IsSupported)
            {
                throw new PlatformNotSupportedException();
            }

            // Anything in the control characters range, and anything above short.MaxValue but less than or equal char.MaxValue
            // That's because anything between 32768 and 65535 (inclusive) will overflow and become negative.
            Vector128 <short> mask = AdvSimd.CompareLessThan(sourceValue, s_spaceMaskInt16);

            mask = AdvSimd.Or(mask, AdvSimd.CompareEqual(sourceValue, s_quotationMarkMaskInt16));
            mask = AdvSimd.Or(mask, AdvSimd.CompareEqual(sourceValue, s_reverseSolidusMaskInt16));

            // Anything above the ASCII range, and also including the leftover control character in the ASCII range - 0x7F
            // When this method is called with only ASCII data, 0x7F is the only value that would meet this comparison.
            // However, when called from "Default", the source could contain characters outside the ASCII range.
            mask = AdvSimd.Or(mask, AdvSimd.CompareGreaterThan(sourceValue, s_tildeMaskInt16));

            return(mask);
        }
Exemplo n.º 14
0
 static Vector128 <float> AdvSimd_CompareGreaterThan_Vector128_Single_Zero(Vector128 <float> left)
 {
     return(AdvSimd.CompareGreaterThan(left, Vector128 <float> .Zero));
 }
Exemplo n.º 15
0
 static Vector128 <byte> AdvSimd_CompareGreaterThan_Vector128_Byte_Zero(Vector128 <byte> left)
 {
     return(AdvSimd.CompareGreaterThan(left, Vector128 <byte> .Zero));
 }