diff options
author | Tanner Gooding <tagoo@outlook.com> | 2018-07-09 18:42:01 -0700 |
---|---|---|
committer | Tanner Gooding <tagoo@outlook.com> | 2018-07-10 08:51:20 -0700 |
commit | 6de41e2f4ffd8971d767e2aadb195f8c51286479 (patch) | |
tree | a30ee4805394b8c52c1a3c00ddd55d29ae55f01a /tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs | |
parent | 2d7baf26bcb149610f261b7eeee5d59c19cfc1be (diff) | |
download | coreclr-6de41e2f4ffd8971d767e2aadb195f8c51286479.tar.gz coreclr-6de41e2f4ffd8971d767e2aadb195f8c51286479.tar.bz2 coreclr-6de41e2f4ffd8971d767e2aadb195f8c51286479.zip |
Regenerating the x86 HWIntrinsic tests to cover struct field scenarios
Diffstat (limited to 'tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs')
-rw-r--r-- | tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs index 538ccde610..10b42ad94a 100644 --- a/tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs +++ b/tests/src/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplySubtractNegated.Double.cs @@ -64,11 +64,17 @@ namespace JIT.HardwareIntrinsics.X86 test.RunLclVarScenario_LoadAligned(); } - // Validates passing the field of a local works - test.RunLclFldScenario(); + // Validates passing the field of a local class works + test.RunClassLclFldScenario(); - // Validates passing an instance member works - test.RunFldScenario(); + // Validates passing an instance member of a class works + test.RunClassFldScenario(); + + // Validates passing the field of a local struct works + test.RunStructLclFldScenario(); + + // Validates passing an instance member of a struct works + test.RunStructFldScenario(); } else { @@ -85,6 +91,36 @@ namespace JIT.HardwareIntrinsics.X86 public sealed unsafe class SimpleTernaryOpTest__MultiplySubtractNegatedDouble { + private struct TestStruct + { + public Vector256<Double> _fld1; + public Vector256<Double> _fld2; + public Vector256<Double> _fld3; + + public static TestStruct Create() + { + var testStruct = new TestStruct(); + var random = new Random(); + + for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); } + Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>()); + for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); } + Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>()); + for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(random.NextDouble()); } + Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>()); + + return testStruct; + } + + public void RunStructFldScenario(SimpleTernaryOpTest__MultiplySubtractNegatedDouble testClass) + { + var result = Fma.MultiplySubtractNegated(_fld1, _fld2, _fld3); + + Unsafe.Write(testClass._dataTable.outArrayPtr, result); + testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); + } + } + private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double); @@ -261,7 +297,7 @@ namespace JIT.HardwareIntrinsics.X86 ValidateResult(firstOp, secondOp, thirdOp, _dataTable.outArrayPtr); } - public void RunLclFldScenario() + public void RunClassLclFldScenario() { var test = new SimpleTernaryOpTest__MultiplySubtractNegatedDouble(); var result = Fma.MultiplySubtractNegated(test._fld1, test._fld2, test._fld3); @@ -270,7 +306,7 @@ namespace JIT.HardwareIntrinsics.X86 ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } - public void RunFldScenario() + public void RunClassFldScenario() { var result = Fma.MultiplySubtractNegated(_fld1, _fld2, _fld3); @@ -278,6 +314,21 @@ namespace JIT.HardwareIntrinsics.X86 ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } + public void RunStructLclFldScenario() + { + var test = TestStruct.Create(); + var result = Fma.MultiplySubtractNegated(test._fld1, test._fld2, test._fld3); + + Unsafe.Write(_dataTable.outArrayPtr, result); + ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); + } + + public void RunStructFldScenario() + { + var test = TestStruct.Create(); + test.RunStructFldScenario(this); + } + public void RunUnsupportedScenario() { Succeeded = false; |