("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarDouble()
+ {
+ var test = new VectorCreate__CreateScalarDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarDouble
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector64<Double> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ bool succeeded = true;
+
+ if (resultElements[0] != expectedValue)
+ {
+ succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
+ }
+ }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt64()
+ {
+ var test = new VectorCreate__CreateScalarInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector64<Int64> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ bool succeeded = true;
+
+ if (resultElements[0] != expectedValue)
+ {
+ succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
+ }
+ }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt64()
+ {
+ var test = new VectorCreate__CreateScalarUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector64<UInt64> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ bool succeeded = true;
+
+ if (resultElements[0] != expectedValue)
+ {
+ succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
+ }
+ }
+ }
+}
["Create.UInt32"] = CreateUInt32,
["Create.UInt64"] = CreateUInt64,
["CreateScalar.Byte"] = CreateScalarByte,
+ ["CreateScalar.Double"] = CreateScalarDouble,
["CreateScalar.Int16"] = CreateScalarInt16,
["CreateScalar.Int32"] = CreateScalarInt32,
+ ["CreateScalar.Int64"] = CreateScalarInt64,
["CreateScalar.SByte"] = CreateScalarSByte,
["CreateScalar.Single"] = CreateScalarSingle,
["CreateScalar.UInt16"] = CreateScalarUInt16,
["CreateScalar.UInt32"] = CreateScalarUInt32,
+ ["CreateScalar.UInt64"] = CreateScalarUInt64,
["CreateScalarUnsafe.Byte"] = CreateScalarUnsafeByte,
["CreateScalarUnsafe.Int16"] = CreateScalarUnsafeInt16,
["CreateScalarUnsafe.Int32"] = CreateScalarUnsafeInt32,
}
}
+ /// <summary>Creates a new <see cref="Vector64{Double}" /> instance with the first element initialized to the specified value and the remaining elements initialized to zero.</summary>
+ /// <param name="value">The value that element 0 will be initialized to.</param>
+ /// <returns>A new <see cref="Vector64{Double}" /> instance with the first element initialized to <paramref name="value"/> and the remaining elements initialized to zero.</returns>
+ public static unsafe Vector64<double> CreateScalar(double value)
+ {
+ if (AdvSimd.IsSupported)
+ {
+ return Create(value);
+ }
+
+ return SoftwareFallback(value);
+
+ static Vector64<double> SoftwareFallback(double value)
+ {
+ return Unsafe.As<double, Vector64<double>>(ref value);
+ }
+ }
+
/// <summary>Creates a new <see cref="Vector64{Int16}" /> instance with the first element initialized to the specified value and the remaining elements initialized to zero.</summary>
/// <param name="value">The value that element 0 will be initialized to.</param>
/// <returns>A new <see cref="Vector64{Int16}" /> instance with the first element initialized to <paramref name="value"/> and the remaining elements initialized to zero.</returns>
}
}
+ /// <summary>Creates a new <see cref="Vector64{Int64}" /> instance with the first element initialized to the specified value and the remaining elements initialized to zero.</summary>
+ /// <param name="value">The value that element 0 will be initialized to.</param>
+ /// <returns>A new <see cref="Vector64{Int64}" /> instance with the first element initialized to <paramref name="value"/> and the remaining elements initialized to zero.</returns>
+ public static unsafe Vector64<long> CreateScalar(long value)
+ {
+ if (AdvSimd.Arm64.IsSupported)
+ {
+ return Create(value);
+ }
+
+ return SoftwareFallback(value);
+
+ static Vector64<long> SoftwareFallback(long value)
+ {
+ return Unsafe.As<long, Vector64<long>>(ref value);
+ }
+ }
+
/// <summary>Creates a new <see cref="Vector64{SByte}" /> instance with the first element initialized to the specified value and the remaining elements initialized to zero.</summary>
/// <param name="value">The value that element 0 will be initialized to.</param>
/// <returns>A new <see cref="Vector64{SByte}" /> instance with the first element initialized to <paramref name="value"/> and the remaining elements initialized to zero.</returns>
}
}
+
+ /// <summary>Creates a new <see cref="Vector64{UInt64}" /> instance with the first element initialized to the specified value and the remaining elements initialized to zero.</summary>
+ /// <param name="value">The value that element 0 will be initialized to.</param>
+ /// <returns>A new <see cref="Vector64{UInt64}" /> instance with the first element initialized to <paramref name="value"/> and the remaining elements initialized to zero.</returns>
+ [CLSCompliant(false)]
+ public static unsafe Vector64<ulong> CreateScalar(ulong value)
+ {
+ if (AdvSimd.Arm64.IsSupported)
+ {
+ return Create(value);
+ }
+
+ return SoftwareFallback(value);
+
+ static Vector64<ulong> SoftwareFallback(ulong value)
+ {
+ return Unsafe.As<ulong, Vector64<ulong>>(ref value);
+ }
+ }
+
/// <summary>Creates a new <see cref="Vector64{Byte}" /> instance with the first element initialized to the specified value and the remaining elements left uninitialized.</summary>
/// <param name="value">The value that element 0 will be initialized to.</param>
/// <returns>A new <see cref="Vector64{Byte}" /> instance with the first element initialized to <paramref name="value"/> and the remaining elements left uninitialized.</returns>
[System.CLSCompliantAttribute(false)]
public static System.Runtime.Intrinsics.Vector64<System.UInt64> Create(ulong value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Byte> CreateScalar(byte value) { throw null; }
+ public static System.Runtime.Intrinsics.Vector64<System.Double> CreateScalar(double value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Int16> CreateScalar(short value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Int32> CreateScalar(int value) { throw null; }
+ public static System.Runtime.Intrinsics.Vector64<System.Int64> CreateScalar(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.Runtime.Intrinsics.Vector64<System.SByte> CreateScalar(sbyte value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Single> CreateScalar(float value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.UInt16> CreateScalar(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.Runtime.Intrinsics.Vector64<System.UInt32> CreateScalar(uint value) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Runtime.Intrinsics.Vector64<System.UInt64> CreateScalar(ulong value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Byte> CreateScalarUnsafe(byte value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Int16> CreateScalarUnsafe(short value) { throw null; }
public static System.Runtime.Intrinsics.Vector64<System.Int32> CreateScalarUnsafe(int value) { throw null; }