fix SSE2 intrinsic MoveScalar for type long and ulong
authorhelloguo <xiangyang.guo@intel.com>
Sat, 19 May 2018 00:25:39 +0000 (17:25 -0700)
committerhelloguo <xiangyang.guo@intel.com>
Fri, 1 Jun 2018 20:04:01 +0000 (13:04 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/d0df62609fa6be12b230cbc78df7147445d7fde5

src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar.Int64.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar.UInt64.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_r.Int64.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_r.UInt64.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_ro.Int64.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_ro.UInt64.csproj [new file with mode: 0644]

diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar.Int64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar.Int64.cs
new file mode 100644 (file)
index 0000000..a87a07e
--- /dev/null
@@ -0,0 +1,56 @@
+// 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.
+//
+
+using System;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace IntelHardwareIntrinsicTest
+{
+    internal static partial class Program
+    {
+        private const int Pass = 100;
+        private const int Fail = 0;
+
+        static unsafe int Main(string[] args)
+        {
+            int testResult = Pass;
+            int testsCount = 21;
+            string methodUnderTestName = nameof(Sse2.MoveScalar);
+
+            if (Sse2.IsSupported)
+            {
+                using (var longTable = TestTableScalarSse2<long, long>.Create(testsCount))
+                {
+                    for (int i = 0; i < testsCount; i++)
+                    {
+                        (Vector128<long>, Vector128<long>) value = longTable[i];
+                        Vector128<long> result = Sse2.MoveScalar(value.Item1);
+                        longTable.SetOutArray(result, i);
+                    }
+
+                    CheckMethodEight<long, long> checkLong = (Span<long> x, Span<long> y, Span<long> z, Span<long> a) =>
+                    {
+                        a[0] = x[0];
+                        a[1] = 0;
+                        return a[0] == z[0] && a[1] == z[1];
+                    };
+
+                    if (!longTable.CheckResult(checkLong))
+                    {
+                        PrintError(longTable, methodUnderTestName, "(Span<long> x, Span<long> y, Span<long> z, Span<long> a) => MoveScalar", checkLong);
+                        testResult = Fail;
+                    }
+                }
+            }
+            else
+            {
+                Console.WriteLine($"Sse2.IsSupported: {Sse2.IsSupported}, skipped tests of {typeof(Sse2)}.{methodUnderTestName}");
+            }
+
+            return testResult;
+        }
+    }
+}
diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar.UInt64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar.UInt64.cs
new file mode 100644 (file)
index 0000000..6e2267f
--- /dev/null
@@ -0,0 +1,56 @@
+// 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.
+//
+
+using System;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace IntelHardwareIntrinsicTest
+{
+    internal static partial class Program
+    {
+        private const int Pass = 100;
+        private const int Fail = 0;
+
+        static unsafe int Main(string[] args)
+        {
+            int testResult = Pass;
+            int testsCount = 21;
+            string methodUnderTestName = nameof(Sse2.MoveScalar);
+
+            if (Sse2.IsSupported)
+            {
+                using (var ulongTable = TestTableScalarSse2<ulong, ulong>.Create(testsCount))
+                {
+                    for (int i = 0; i < testsCount; i++)
+                    {
+                        (Vector128<ulong>, Vector128<ulong>) value = ulongTable[i];
+                        Vector128<ulong> result = Sse2.MoveScalar(value.Item1);
+                        ulongTable.SetOutArray(result, i);
+                    }
+
+                    CheckMethodEight<ulong, ulong> checkUlong = (Span<ulong> x, Span<ulong> y, Span<ulong> z, Span<ulong> a) =>
+                    {
+                        a[0] = x[0];
+                        a[1] = 0;
+                        return a[0] == z[0] && a[1] == z[1];
+                    };
+
+                    if (!ulongTable.CheckResult(checkUlong))
+                    {
+                        PrintError(ulongTable, methodUnderTestName, "(Span<ulong> x, Span<ulong> y, Span<ulong> z, Span<ulong> a) => MoveScalar", checkUlong);
+                        testResult = Fail;
+                    }
+                }
+            }
+            else
+            {
+                Console.WriteLine($"Sse2.IsSupported: {Sse2.IsSupported}, skipped tests of {typeof(Sse2)}.{methodUnderTestName}");
+            }
+
+            return testResult;
+        }
+    }
+}
diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_r.Int64.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_r.Int64.csproj
new file mode 100644 (file)
index 0000000..5b7e4cd
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{0B80D700-B05A-4D16-BAF9-ED6EDD08B693}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <!-- Default configurations to help VS understand the configurations -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <PropertyGroup>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MoveScalar.Int64.cs" />
+    <Compile Include="TestTableSse2.cs" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_r.UInt64.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_r.UInt64.csproj
new file mode 100644 (file)
index 0000000..bbd9c11
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{0B80D700-B05A-4D16-BAF9-ED6EDD08B693}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <!-- Default configurations to help VS understand the configurations -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <PropertyGroup>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MoveScalar.UInt64.cs" />
+    <Compile Include="TestTableSse2.cs" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_ro.Int64.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_ro.Int64.csproj
new file mode 100644 (file)
index 0000000..12cdbf4
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{12E4FEBD-6650-40E9-8D42-99BCC12FCAB9}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <!-- Default configurations to help VS understand the configurations -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <PropertyGroup>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MoveScalar.Int64.cs" />
+    <Compile Include="TestTableSse2.cs" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_ro.UInt64.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MoveScalar_ro.UInt64.csproj
new file mode 100644 (file)
index 0000000..a61a23f
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{12E4FEBD-6650-40E9-8D42-99BCC12FCAB9}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <!-- Default configurations to help VS understand the configurations -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <PropertyGroup>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MoveScalar.UInt64.cs" />
+    <Compile Include="TestTableSse2.cs" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+  </PropertyGroup>
+</Project>
\ No newline at end of file