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
{
public sealed unsafe class AlternatingBinaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(AlternatingBinaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(left, right, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new AlternatingBinaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
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
{
public sealed unsafe class AlternatingTernaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+ public {Op3VectorType}<{Op3BaseType}> _fld3;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = {NextValueOp3}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3VectorType}<{Op3BaseType}>, byte>(ref testStruct._fld3), ref Unsafe.As<{Op3BaseType}, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<{Op3VectorType}<{Op3BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(AlternatingTernaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2, _fld3);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(firstOp, secondOp, thirdOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new AlternatingTernaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2, test._fld3);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2, _fld3);
ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(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;
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
{
public sealed unsafe class BooleanBinaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(BooleanBinaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+ testClass.ValidateResult(_fld1, _fld2, result);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
public void RunReflectionScenario_UnsafeRead()
{
var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2VectorType}<{Op2BaseType}>) });
-
+
if (method != null)
{
var result = method.Invoke(null, new object[] {
public void RunReflectionScenario_Load()
{
var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2VectorType}<{Op2BaseType}>) });
-
+
if (method != null)
{
var result = method.Invoke(null, new object[] {
public void RunReflectionScenario_LoadAligned()
{
var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2VectorType}<{Op2BaseType}>) });
-
+
if (method != null)
{
var result = method.Invoke(null, new object[] {
ValidateResult(left, right, result);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new BooleanBinaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+ ValidateResult(test._fld1, test._fld2, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
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
{
public sealed unsafe class BooleanComparisonOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(BooleanComparisonOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+ testClass.ValidateResult(_fld1, _fld2, result);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(left, right, result);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new BooleanComparisonOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+ ValidateResult(test._fld1, test._fld2, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
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
{
public sealed unsafe class BooleanTwoComparisonOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(BooleanTwoComparisonOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+ testClass.ValidateResult(_fld1, _fld2, result);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
public void RunReflectionScenario_UnsafeRead()
{
var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2VectorType}<{Op2BaseType}>) });
-
+
if (method != null)
{
var result = method.Invoke(null, new object[] {
public void RunReflectionScenario_Load()
{
var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2VectorType}<{Op2BaseType}>) });
-
+
if (method != null)
{
var result = method.Invoke(null, new object[] {
public void RunReflectionScenario_LoadAligned()
{var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2VectorType}<{Op2BaseType}>) });
-
+
if (method != null)
{
var result = method.Invoke(null, new object[] {
ValidateResult(left, right, result);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new BooleanTwoComparisonOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+ ValidateResult(test._fld1, test._fld2, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}()
{
- var test = new BooleanComparisonOpTest__{Method}{RetBaseType}();
+ var test = new BooleanUnaryOpTest__{Method}{RetBaseType}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class BooleanComparisonOpTest__{Method}{RetBaseType}
+ public sealed unsafe class BooleanUnaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(BooleanUnaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld);
+ testClass.ValidateResult(_fld, result);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private BooleanUnaryOpTest__DataTable<{Op1BaseType}> _dataTable;
- static BooleanComparisonOpTest__{Method}{RetBaseType}()
+ static BooleanUnaryOpTest__{Method}{RetBaseType}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public BooleanComparisonOpTest__{Method}{RetBaseType}()
+ public BooleanUnaryOpTest__{Method}{RetBaseType}()
{
Succeeded = true;
ValidateResult(value, result);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new BooleanComparisonOpTest__{Method}{RetBaseType}();
+ var test = new BooleanUnaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld);
ValidateResult(test._fld, result);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld);
ValidateResult(_fld, result);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld);
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ExtractScalarTest__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
+ public sealed unsafe class ExtractScalarTest__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ExtractScalarTest__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
- static SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ static ExtractScalarTest__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ public ExtractScalarTest__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ExtractScalarTest__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld, {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld, {Imm});
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld, {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}Store()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store();
+ var test = new ExtractStoreTest__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store
+ public sealed unsafe class ExtractStoreTest__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ExtractStoreTest__{Method}{RetBaseType}{Imm} testClass)
+ {
+ {Isa}.{Method}(({Op1BaseType}*)testClass._dataTable.outArrayPtr, _fld, {Imm});
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
- static SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store()
+ static ExtractStoreTest__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store()
+ public ExtractStoreTest__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
_clsVar,
{Imm}
);
+
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_UnsafeRead()
{
var firstOp = Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArrayPtr);
{Isa}.{Method}(({Op1BaseType}*)_dataTable.outArrayPtr, firstOp, {Imm});
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
var firstOp = {LoadIsa}.Load{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArrayPtr));
{Isa}.{Method}(({Op1BaseType}*)_dataTable.outArrayPtr, firstOp, {Imm});
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_LoadAligned()
{
var firstOp = {LoadIsa}.LoadAligned{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArrayPtr));
{Isa}.{Method}(({Op1BaseType}*)_dataTable.outArrayPtr, firstOp, {Imm});
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store();
+ var test = new ExtractStoreTest__{Method}{RetBaseType}{Imm}();
{Isa}.{Method}(({Op1BaseType}*)_dataTable.outArrayPtr, test._fld, {Imm});
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
{Isa}.{Method}(({Op1BaseType}*)_dataTable.outArrayPtr, _fld, {Imm});
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ {Isa}.{Method}(({Op1BaseType}*)_dataTable.outArrayPtr, test._fld, {Imm});
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
}
public void RunUnsupportedScenario()
{
private static void {Method}{RetBaseType}{Imm}()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ExtractVector128Test__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
+ public sealed unsafe class ExtractVector128Test__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ExtractVector128Test__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
- static SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ static ExtractVector128Test__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ public ExtractVector128Test__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ExtractVector128Test__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld, {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld, {Imm});
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld, {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] | right[i]) != result[i]"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] | right[i]) != result[i]"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] | right[i]) != result[i]"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(Random.Next(byte.MinValue, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(Random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(Random.Next(ushort.MinValue, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(Random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(Random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(Random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(Random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "Random.NextDouble()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(byte.MinValue, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "random.NextDouble()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] << 1) != result[i]"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] << 1) != result[i]"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] << 1) != result[i]"}),
{
private static void {Method}{RetBaseType}()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}();
+ var test = new GenericUnaryOpTest__{Method}{RetBaseType}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}
+ public sealed unsafe class GenericUnaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(GenericUnaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}<{RetBaseType}>(_fld);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
- static SimpleUnaryOpTest__{Method}{RetBaseType}()
+ static GenericUnaryOpTest__{Method}{RetBaseType}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public SimpleUnaryOpTest__{Method}{RetBaseType}()
+ public GenericUnaryOpTest__{Method}{RetBaseType}()
{
Succeeded = true;
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}();
+ var test = new GenericUnaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}<{RetBaseType}>(test._fld);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}<{RetBaseType}>(_fld);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
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
{
public sealed unsafe class HorizontalBinaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(HorizontalBinaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(left, right, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new HorizontalBinaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}()
{
- var test = new SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ImmBinaryOpTest__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}
+ public sealed unsafe class ImmBinaryOpTest__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ImmBinaryOpTest__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}> _dataTable;
- static SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}()
+ static ImmBinaryOpTest__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
- public SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}()
+ public ImmBinaryOpTest__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(left, right, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ImmBinaryOpTest__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld1, test._fld2, {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2, {Imm});
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2, {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ImmUnaryOpTest__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
+ public sealed unsafe class ImmUnaryOpTest__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ImmUnaryOpTest__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
- static SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ static ImmUnaryOpTest__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ public ImmUnaryOpTest__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new ImmUnaryOpTest__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld, {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld, {Imm});
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld, {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}Load()
{
- var test = new SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load();
+ var test = new InsertLoadTest__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load
+ public sealed unsafe class InsertLoadTest__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(InsertLoadTest__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, ({Op2BaseType}*)testClass._dataTable.inArray2Ptr, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, ({Op2BaseType}*)testClass._dataTable.inArray2Ptr, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}> _dataTable;
- static SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load()
+ static InsertLoadTest__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
- public SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load()
+ public InsertLoadTest__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(left, right, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load();
+ var test = new InsertLoadTest__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld1, ({Op2BaseType}*)(_dataTable.inArray2Ptr), {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, ({Op2BaseType}*)(_dataTable.inArray2Ptr), _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, ({Op2BaseType}*)(_dataTable.inArray2Ptr), {Imm});
ValidateResult(_fld1, ({Op2BaseType}*)(_dataTable.inArray2Ptr), _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, ({Op2BaseType}*)(_dataTable.inArray2Ptr), {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, ({Op2BaseType}*)(_dataTable.inArray2Ptr), _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new InsertScalarTest__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
+ public sealed unsafe class InsertScalarTest__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(InsertScalarTest__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld, {Data}, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
- static SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ static InsertScalarTest__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
- public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
+ public InsertScalarTest__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new InsertScalarTest__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld, {Data}, {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld, {Data}, {Imm});
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld, {Data}, {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}{Imm}()
{
- var test = new SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new InsertVector128Test__{Method}{RetBaseType}{Imm}();
if (test.IsSupported)
{
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
{
}
}
- public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}
+ public sealed unsafe class InsertVector128Test__{Method}{RetBaseType}{Imm}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(InsertVector128Test__{Method}{RetBaseType}{Imm} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2, {Imm});
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}> _dataTable;
- static SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}()
+ static InsertVector128Test__{Method}{RetBaseType}{Imm}()
{
var random = new Random();
Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
- public SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}()
+ public InsertVector128Test__{Method}{RetBaseType}{Imm}()
{
Succeeded = true;
ValidateResult(left, right, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
- var test = new SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}();
+ var test = new InsertVector128Test__{Method}{RetBaseType}{Imm}();
var result = {Isa}.{Method}(test._fld1, test._fld2, {Imm});
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2, {Imm});
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2, {Imm});
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
// Validates passing a local works, using Unsafe.ReadUnaligned
test.RunLclVarScenario_UnsafeRead();
- // 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
{
public sealed unsafe class ScalarBinaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1BaseType} _fld1;
+ public {Op2BaseType} _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ testStruct._fld1 = {NextValueOp1};
+ testStruct._fld2 = {NextValueOp2};
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ScalarBinaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+ testClass.ValidateResult(_fld1, _fld2, result);
+ }
+ }
+
private static {Op1BaseType} _data1;
- private static {Op1BaseType} _data2;
+ private static {Op2BaseType} _data2;
private static {Op1BaseType} _clsVar1;
- private static {Op1BaseType} _clsVar2;
+ private static {Op2BaseType} _clsVar2;
private {Op1BaseType} _fld1;
- private {Op1BaseType} _fld2;
+ private {Op2BaseType} _fld2;
static ScalarBinaryOpTest__{Method}{RetBaseType}()
{
Succeeded = true;
var random = new Random();
-
+
_fld1 = {NextValueOp1};
_fld2 = {NextValueOp2};
ValidateResult(data1, data2, result);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new ScalarBinaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+
+ ValidateResult(test._fld1, test._fld2, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
{
private static void {Method}{RetBaseType}()
{
- bool skipIf32Bit = (typeof({Op1BaseType}) == typeof(Int64)) ||
- (typeof({Op1BaseType}) == typeof(UInt64));
-
- if (skipIf32Bit && !Environment.Is64BitProcess)
- {
- return;
- }
-
var test = new ScalarSimdUnaryOpTest__{Method}{RetBaseType}();
if (test.IsSupported)
{
// Validates basic functionality works
- test.RunBasicScenario();
+ test.RunBasicScenario_UnsafeRead();
// Validates calling via reflection works
- test.RunReflectionScenario();
+ test.RunReflectionScenario_UnsafeRead();
// Validates passing a static member works
test.RunClsVarScenario();
// Validates passing a local works
- test.RunLclVarScenario();
+ test.RunLclVarScenario_UnsafeRead();
- // 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
{
public sealed unsafe class ScalarSimdUnaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1BaseType} _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ testStruct._fld = {NextValueOp1};
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ScalarSimdUnaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
- private static readonly Random Random = new Random();
+ private static {Op1BaseType} _data;
private static {Op1BaseType} _clsVar;
static ScalarSimdUnaryOpTest__{Method}{RetBaseType}()
{
+ var random = new Random();
_clsVar = {NextValueOp1};
}
{
Succeeded = true;
+ var random = new Random();
_fld = {NextValueOp1};
+ _data = {NextValueOp1};
_dataTable = new ScalarSimdUnaryOpTest__DataTable<{RetBaseType}>(new {RetBaseType}[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => {Isa}.IsSupported;
+ public bool IsSupported => {Isa}.IsSupported && (Environment.Is64BitProcess || ((typeof({RetBaseType}) != typeof(long)) && (typeof({RetBaseType}) != typeof(ulong))));
public bool Succeeded { get; set; }
- public void RunBasicScenario()
+ public void RunBasicScenario_UnsafeRead()
{
- var firstOp = {NextValueOp1};
var result = {Isa}.{Method}(
- firstOp
+ Unsafe.ReadUnaligned<{Op1BaseType}>(ref Unsafe.As<{Op1BaseType}, byte>(ref _data))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
+ ValidateResult(_data, _dataTable.outArrayPtr);
}
- public void RunReflectionScenario()
+ public void RunReflectionScenario_UnsafeRead()
{
- var firstOp = {NextValueOp1};
- var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1BaseType}) });
- var result = method.Invoke(null, new object[] { firstOp });
+ var result = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1BaseType}) })
+ .Invoke(null, new object[] {
+ Unsafe.ReadUnaligned<{Op1BaseType}>(ref Unsafe.As<{Op1BaseType}, byte>(ref _data))
+ });
Unsafe.Write(_dataTable.outArrayPtr, ({RetVectorType}<{RetBaseType}>)(result));
- ValidateResult(firstOp, _dataTable.outArrayPtr);
+ ValidateResult(_data, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario()
+ public void RunLclVarScenario_UnsafeRead()
{
- var firstOp = {NextValueOp1};
- var result = {Isa}.{Method}(firstOp);
+ var data = Unsafe.ReadUnaligned<{Op1BaseType}>(ref Unsafe.As<{Op1BaseType}, byte>(ref _data));
+ var result = {Isa}.{Method}(data);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
+ ValidateResult(data, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new ScalarSimdUnaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
try
{
- RunBasicScenario();
+ RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
// Validates passing a local works, using Unsafe.ReadUnaligned
test.RunLclVarScenario_UnsafeRead();
- // 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
{
public sealed unsafe class ScalarUnaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1BaseType} _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ testStruct._fld = {NextValueOp1};
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(ScalarUnaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld);
+ testClass.ValidateResult(_fld, result);
+ }
+ }
+
private static {Op1BaseType} _data;
private static {Op1BaseType} _clsVar;
ValidateResult(data, result);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new ScalarUnaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld);
ValidateResult(test._fld, result);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld);
ValidateResult(_fld, result);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
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
{
public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleBinaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(left, right, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new SimpleBinaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;
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
{
public sealed unsafe class SimpleTernaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2VectorType}<{Op2BaseType}> _fld2;
+ public {Op3VectorType}<{Op3BaseType}> _fld3;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref testStruct._fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = {NextValueOp3}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3VectorType}<{Op3BaseType}>, byte>(ref _clsVar3), ref Unsafe.As<{Op3BaseType}, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<{Op3VectorType}<{Op3BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleTernaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2, _fld3);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(firstOp, secondOp, thirdOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new SimpleTernaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld1, test._fld2, test._fld3);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld1, _fld2, _fld3);
ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(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;
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
{
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}
{
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleUnaryOpTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
+ }
+ }
+
private static readonly int LargestVectorSize = {LargestVectorSize};
private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
- public void RunLclFldScenario()
+ public void RunClassLclFldScenario()
{
var test = new SimpleUnaryOpTest__{Method}{RetBaseType}();
var result = {Isa}.{Method}(test._fld);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
- public void RunFldScenario()
+ public void RunClassFldScenario()
{
var result = {Isa}.{Method}(_fld);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
+ public void RunStructLclFldScenario()
+ {
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
public void RunUnsupportedScenario()
{
Succeeded = false;