From 34569bd74ec2df228a054e9f1c9fb6fb53b9fe17 Mon Sep 17 00:00:00 2001 From: Fei Peng Date: Thu, 10 Jan 2019 15:36:37 -0800 Subject: Don't optimize BMI2 MultiplyNoFlags away --- .../X86/Regression/GitHub_21899/GitHub_21899.cs | 70 ++++++++++++++++++++++ .../Regression/GitHub_21899/GitHub_21899_r.csproj | 34 +++++++++++ .../Regression/GitHub_21899/GitHub_21899_ro.csproj | 34 +++++++++++ 3 files changed, 138 insertions(+) create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_r.csproj create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_ro.csproj (limited to 'tests') diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs new file mode 100644 index 0000000000..31a51015f6 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs @@ -0,0 +1,70 @@ +using System; +using System.Runtime.Intrinsics.X86; +using System.Runtime.Intrinsics; +using System.Runtime.CompilerServices; + +namespace GitHub_21899 +{ + class GitHub_21899 + { + + static int Main(string[] args) + { + bool pass = true; + pass = test1() && test2() && test3() && test4(); + return pass ? 100 : 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe ulong MultiplyNoFlags1(ulong a, ulong b) + { + ulong r; + Bmi2.X64.MultiplyNoFlags(a, b, &r); + return r; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe ulong MultiplyNoFlags2(ulong a, ulong b) + { + ulong r; + r = Bmi2.X64.MultiplyNoFlags(a, b, &r); + return r; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe uint MultiplyNoFlags3(uint a, uint b) + { + uint r; + Bmi2.MultiplyNoFlags(a, b, &r); + return r; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe uint MultiplyNoFlags4(uint a, uint b) + { + uint r; + r = Bmi2.MultiplyNoFlags(a, b, &r); + return r; + } + + static bool test1() + { + return !Bmi2.X64.IsSupported || (MultiplyNoFlags1(1111111111111UL, 1111111111111UL) == 1107357235536201905UL); + } + + static bool test2() + { + return !Bmi2.X64.IsSupported || (MultiplyNoFlags2(1111111111111UL, 1111111111111UL) == 66926UL); + } + + static bool test3() + { + return !Bmi2.IsSupported || (MultiplyNoFlags3(1111111U, 1111111U) == 1912040369U); + } + + static bool test4() + { + return !Bmi2.IsSupported || (MultiplyNoFlags4(1111111U, 1111111U) == 287U); + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_r.csproj new file mode 100644 index 0000000000..c4589de648 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_r.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + Embedded + + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_ro.csproj new file mode 100644 index 0000000000..05e730657a --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_ro.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + Embedded + True + + + + + + + + + + -- cgit v1.2.3