示例#1
0
 private void ValidateResult(Vector64 <UInt64> result, [CallerMemberName] string method = "")
 {
     UInt64[] resultElements = new UInt64[ElementCount];
     Unsafe.WriteUnaligned(ref Unsafe.As <UInt64, byte>(ref resultElements[0]), result);
     ValidateResult(resultElements, method);
 }
示例#2
0
            public void RunStructFldScenario(VectorBooleanBinaryOpTest__GreaterThanOrEqualAnyInt16 testClass)
            {
                var result = Vector64.GreaterThanOrEqualAny(_fld1, _fld2);

                testClass.ValidateResult(_fld1, _fld2, result);
            }
示例#3
0
 private void ValidateWithResult(Vector64 <Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
 {
     Double[] resultElements = new Double[ElementCount];
     Unsafe.WriteUnaligned(ref Unsafe.As <Double, byte>(ref resultElements[0]), result);
     ValidateWithResult(resultElements, values, insertedValue, method);
 }
示例#4
0
            public void RunStructFldScenario(VectorBooleanBinaryOpTest__LessThanAllInt32 testClass)
            {
                var result = Vector64.LessThanAll(_fld1, _fld2);

                testClass.ValidateResult(_fld1, _fld2, result);
            }
 /// <summary>
 /// Vector CompareTest
 /// For each element result[elem] = (left[elem] &amp; right[elem]) ? ~0 : 0
 /// Corresponds to vector forms of ARM64 CMTST
 /// </summary>
 public static Vector64 <T> CompareTest <T>(Vector64 <T> left, Vector64 <T> right) where T : struct
 {
     throw new PlatformNotSupportedException();
 }
        /// TBD Convert...

        /// <summary>
        /// Vector Divide
        /// Corresponds to vector forms of ARM64 FDIV
        /// </summary>
        public static Vector64 <float> Divide(Vector64 <float> left, Vector64 <float> right)
        {
            throw new PlatformNotSupportedException();
        }
 private void ValidateResult(Vector64 <Single> result, Single expectedValue, [CallerMemberName] string method = "")
 {
     Single[] resultElements = new Single[ElementCount];
     Unsafe.WriteUnaligned(ref Unsafe.As <Single, byte>(ref resultElements[0]), result);
     ValidateResult(resultElements, expectedValue, method);
 }
 /// <summary>
 /// Vector CompareGreaterThanOrEqual
 /// For each element result[elem] = (left[elem] >= right[elem]) ? ~0 : 0
 /// Corresponds to vector forms of ARM64 CMGE/CMHS &amp; FCMGE
 /// </summary>
 public static Vector64 <T> CompareGreaterThanOrEqual <T>(Vector64 <T> left, Vector64 <T> right) where T : struct
 {
     throw new PlatformNotSupportedException();
 }
示例#9
0
 private void ValidateWithResult(Vector64 <UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
 {
     UInt32[] resultElements = new UInt32[ElementCount];
     Unsafe.WriteUnaligned(ref Unsafe.As <UInt32, byte>(ref resultElements[0]), result);
     ValidateWithResult(resultElements, values, insertedValue, method);
 }
示例#10
0
        public void RunReflectionScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
            Vector64 <Int16> value;

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object byteResult = typeof(Vector64)
                                .GetMethod(nameof(Vector64.AsByte))
                                .MakeGenericMethod(typeof(Int16))
                                .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <byte>)(byteResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object doubleResult = typeof(Vector64)
                                  .GetMethod(nameof(Vector64.AsDouble))
                                  .MakeGenericMethod(typeof(Int16))
                                  .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <double>)(doubleResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object shortResult = typeof(Vector64)
                                 .GetMethod(nameof(Vector64.AsInt16))
                                 .MakeGenericMethod(typeof(Int16))
                                 .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <short>)(shortResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object intResult = typeof(Vector64)
                               .GetMethod(nameof(Vector64.AsInt32))
                               .MakeGenericMethod(typeof(Int16))
                               .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <int>)(intResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object longResult = typeof(Vector64)
                                .GetMethod(nameof(Vector64.AsInt64))
                                .MakeGenericMethod(typeof(Int16))
                                .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <long>)(longResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object sbyteResult = typeof(Vector64)
                                 .GetMethod(nameof(Vector64.AsSByte))
                                 .MakeGenericMethod(typeof(Int16))
                                 .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <sbyte>)(sbyteResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object floatResult = typeof(Vector64)
                                 .GetMethod(nameof(Vector64.AsSingle))
                                 .MakeGenericMethod(typeof(Int16))
                                 .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <float>)(floatResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object ushortResult = typeof(Vector64)
                                  .GetMethod(nameof(Vector64.AsUInt16))
                                  .MakeGenericMethod(typeof(Int16))
                                  .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <ushort>)(ushortResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object uintResult = typeof(Vector64)
                                .GetMethod(nameof(Vector64.AsUInt32))
                                .MakeGenericMethod(typeof(Int16))
                                .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <uint>)(uintResult), value);

            value = Vector64.Create(TestLibrary.Generator.GetInt16());
            object ulongResult = typeof(Vector64)
                                 .GetMethod(nameof(Vector64.AsUInt64))
                                 .MakeGenericMethod(typeof(Int16))
                                 .Invoke(null, new object[] { value });

            ValidateResult((Vector64 <ulong>)(ulongResult), value);
        }
示例#11
0
        public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));

            UInt32[] values = new UInt32[ElementCount];

            for (int i = 0; i < ElementCount; i++)
            {
                values[i] = TestLibrary.Generator.GetUInt32();
            }

            Vector64 <UInt32> value = Vector64.Create(values[0], values[1]);

            bool succeeded = !expectedOutOfRangeException;

            try
            {
                object result = typeof(Vector64 <UInt32>)
                                .GetMethod(nameof(Vector64 <UInt32> .GetElement), new Type[] { typeof(int) })
                                .Invoke(value, new object[] { imm });
                ValidateGetResult((UInt32)(result), values);
            }
            catch (TargetInvocationException e)
            {
                succeeded = expectedOutOfRangeException &&
                            e.InnerException is ArgumentOutOfRangeException;
            }

            if (!succeeded)
            {
                Succeeded = false;

                TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
                TestLibrary.TestFramework.LogInformation(string.Empty);
            }

            succeeded = !expectedOutOfRangeException;

            UInt32 insertedValue = TestLibrary.Generator.GetUInt32();

            try
            {
                object result2 = typeof(Vector64 <UInt32>)
                                 .GetMethod(nameof(Vector64 <UInt32> .WithElement), new Type[] { typeof(int), typeof(UInt32) })
                                 .Invoke(value, new object[] { imm, insertedValue });
                ValidateWithResult((Vector64 <UInt32>)(result2), values, insertedValue);
            }
            catch (TargetInvocationException e)
            {
                succeeded = expectedOutOfRangeException &&
                            e.InnerException is ArgumentOutOfRangeException;
            }

            if (!succeeded)
            {
                Succeeded = false;

                TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
                TestLibrary.TestFramework.LogInformation(string.Empty);
            }
        }
示例#12
0
 private void ValidateResult(Vector64 <Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
 {
     Int32[] resultElements = new Int32[ElementCount];
     Unsafe.WriteUnaligned(ref Unsafe.As <Int32, byte>(ref resultElements[0]), result);
     ValidateResult(resultElements, expectedValue, method);
 }
示例#13
0
 private void ValidateWithResult(Vector64 <Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
 {
     Int16[] resultElements = new Int16[ElementCount];
     Unsafe.WriteUnaligned(ref Unsafe.As <Int16, byte>(ref resultElements[0]), result);
     ValidateWithResult(resultElements, values, insertedValue, method);
 }
 /// <summary>
 /// Vector BitwiseSelect
 /// For each bit in the vector result[bit] = sel[bit] ? left[bit] : right[bit]
 /// Corresponds to vector forms of ARM64 BSL (Also BIF &amp; BIT)
 /// </summary>
 public static Vector64 <T> BitwiseSelect <T>(Vector64 <T> sel, Vector64 <T> left, Vector64 <T> right) where T : struct
 {
     throw new PlatformNotSupportedException();
 }
示例#15
0
 public static extern void GetVector64UOut(uint e00, uint e01, out Vector64 <uint> value);
 /// <summary>
 /// Vector CompareGreaterThanZero
 /// For each element result[elem] = (left[elem] > 0) ? ~0 : 0
 /// Corresponds to vector forms of ARM64 CMGT &amp; FCMGT
 /// </summary>
 public static Vector64 <T> CompareGreaterThanZero <T>(Vector64 <T> value) where T : struct
 {
     throw new PlatformNotSupportedException();
 }
示例#17
0
 public static extern Vector64 <uint> AddVector64U(Vector64 <uint> lhs, Vector64 <uint> rhs);
 /// <summary>
 /// Vector CompareLessThanOrEqualZero
 /// For each element result[elem] = (left[elem] &lt; 0) ? ~0 : 0
 /// Corresponds to vector forms of ARM64 CMGT &amp; FCMGT
 /// </summary>
 public static Vector64 <T> CompareLessThanOrEqualZero <T>(Vector64 <T> value) where T : struct
 {
     throw new PlatformNotSupportedException();
 }
示例#19
0
 public static extern Vector64 <uint> AddVector64Us(Vector64 <uint> *pValues, int count);
 /// <summary>
 /// Vector abs
 /// Corresponds to vector forms of ARM64 ABS &amp; FABS
 /// </summary>
 public static Vector64 <byte> Abs(Vector64 <sbyte> value)
 {
     throw new PlatformNotSupportedException();
 }
示例#21
0
            public void RunStructFldScenario(VectorBinaryOpTest__DotDouble testClass)
            {
                var result = Vector64.Dot(_fld1, _fld2);

                testClass.ValidateResult(_fld1, _fld2, result);
            }
 /// <summary>
 /// Vector extract item
 ///
 /// result = vector[index]
 ///
 /// Note: In order to be inlined, index must be a JIT time const expression which can be used to
 /// populate the literal immediate field.  Use of a non constant will result in generation of a switch table
 ///
 /// Corresponds to vector forms of ARM64 MOV
 /// </summary>
 public static T Extract <T>(Vector64 <T> vector, byte index) where T : struct
 {
     throw new PlatformNotSupportedException();
 }
示例#23
0
        public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));

            Double[] values = new Double[ElementCount];

            for (int i = 0; i < ElementCount; i++)
            {
                values[i] = TestLibrary.Generator.GetDouble();
            }

            Vector64 <Double> value = Vector64.Create(values[0]);

            bool succeeded = !expectedOutOfRangeException;

            try
            {
                object result = typeof(Vector64)
                                .GetMethod(nameof(Vector64.GetElement))
                                .MakeGenericMethod(typeof(Double))
                                .Invoke(null, new object[] { value, imm });
                ValidateGetResult((Double)(result), values);
            }
            catch (TargetInvocationException e)
            {
                succeeded = expectedOutOfRangeException &&
                            e.InnerException is ArgumentOutOfRangeException;
            }

            if (!succeeded)
            {
                TestLibrary.TestFramework.LogInformation($"Vector64<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
                TestLibrary.TestFramework.LogInformation(string.Empty);

                Succeeded = false;
            }

            succeeded = !expectedOutOfRangeException;

            Double insertedValue = TestLibrary.Generator.GetDouble();

            try
            {
                object result2 = typeof(Vector64)
                                 .GetMethod(nameof(Vector64.WithElement))
                                 .MakeGenericMethod(typeof(Double))
                                 .Invoke(null, new object[] { value, imm, insertedValue });
                ValidateWithResult((Vector64 <Double>)(result2), values, insertedValue);
            }
            catch (TargetInvocationException e)
            {
                succeeded = expectedOutOfRangeException &&
                            e.InnerException is ArgumentOutOfRangeException;
            }

            if (!succeeded)
            {
                TestLibrary.TestFramework.LogInformation($"Vector64<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
                TestLibrary.TestFramework.LogInformation(string.Empty);

                Succeeded = false;
            }
        }