diff options
author | Fei Peng <fei.peng@intel.com> | 2018-02-27 22:18:06 -0800 |
---|---|---|
committer | Fei Peng <fei.peng@intel.com> | 2018-02-27 22:18:06 -0800 |
commit | 552ed75969a642284b5d7c4cd08e6f1e78178ff3 (patch) | |
tree | 016eaf011a93bff5894f462906e01f86a49a5226 /tests | |
parent | 3cb7c002e1325a7614961fd10e9a9f989528370f (diff) | |
download | coreclr-552ed75969a642284b5d7c4cd08e6f1e78178ff3.tar.gz coreclr-552ed75969a642284b5d7c4cd08e6f1e78178ff3.tar.bz2 coreclr-552ed75969a642284b5d7c4cd08e6f1e78178ff3.zip |
Fix StaticCast with NotSupportedException
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs index 3c541f8c9f..707b9b1780 100644 --- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs @@ -11,6 +11,13 @@ using System.Runtime.Intrinsics; namespace IntelHardwareIntrinsicTest { + // that it is intentionally designed to be a struct type that meets + // the generic constraint but is not supported by any intrinsics + struct Num + { + public int a; + } + class Program { const int Pass = 100; @@ -39,12 +46,45 @@ namespace IntelHardwareIntrinsicTest Console.WriteLine(); testResult = Fail; } - } - } + // the successful path is the one that catches the exception, so that does nothing, + // it is the fall-through path that's the error path + try + { + var v = Sse.StaticCast<float, Num>(vf1); + Unsafe.Write(floatTable.outArrayPtr, v); + Console.WriteLine("SSE StaticCast failed on target type test:"); + testResult = Fail; + } + catch (System.NotSupportedException) + { + } + // the successful path is the one that catches the exception, so that does nothing, + // it is the fall-through path that's the error path + try + { + var v = TestSrcType(); + Unsafe.Write(floatTable.outArrayPtr, v); + Console.WriteLine("SSE StaticCast failed on source type test:"); + testResult = Fail; + } + catch (System.NotSupportedException) + { + } + } + } + return testResult; } + + [MethodImpl(MethodImplOptions.NoInlining)] + static Vector128<int> TestSrcType() + { + Vector128<Num> v1 = new Vector128<Num>(); + Vector128<Num> v2 = new Vector128<Num>(); + return Sse2.Add(Sse.StaticCast<Num, int>(v1), Sse.StaticCast<Num, int>(v2)); + } public unsafe struct TestTable<T, U> : IDisposable where T : struct where U : struct { |