Disable tests for generic hardware intrinsic
[platform/upstream/coreclr.git] / tests / src / JIT / HardwareIntrinsics / X86 / General / VectorUnused.cs
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 //
5
6 // This test case is ported from S.N.Vector counterpart 
7 // https://github.com/dotnet/coreclr/blob/master/tests/src/JIT/SIMD/VectorUnused.cs
8
9 using System;
10 using System.Runtime.Intrinsics;
11 using System.Runtime.Intrinsics.X86;
12
13 internal partial class IntelHardwareIntrinsicTest
14 {
15     private const int Pass = 100;
16     private const int Fail = -1;
17
18     private class Vector128UnusedTest<T> where T : struct, IComparable<T>, IEquatable<T>
19     {
20         public static int VectorUnused(T t1, T t2)
21         {
22             if (Sse2.IsSupported)
23             {
24                 Vector128<T> v1 = SetAllVector128<T>(t1);
25                 v1 = Vector128Add<T>(v1, SetZeroVector128<T>());
26             }
27
28             return Pass;
29         }
30     }
31
32     private class Vector256UnusedTest<T> where T : struct, IComparable<T>, IEquatable<T>
33     {
34         public static int VectorUnused(T t1, T t2)
35         {
36             if (Avx.IsSupported)
37             {
38                 Vector256<T> v1 = Avx.SetAllVector256<T>(t1);
39                 v1 = Vector256Add<T>(v1, Avx.SetAllVector256<T>(t2));
40             }
41             return Pass;
42         }
43     }
44
45     private static int Main()
46     {
47         int returnVal = Pass;
48
49         if (Vector128UnusedTest<float>.VectorUnused(3f, 2f) != Pass) returnVal = Fail;
50         if (Vector128UnusedTest<double>.VectorUnused(3, 2) != Pass) returnVal = Fail;
51         if (Vector128UnusedTest<int>.VectorUnused(3, 2) != Pass) returnVal = Fail;
52         if (Vector128UnusedTest<uint>.VectorUnused(3, 2) != Pass) returnVal = Fail;
53         if (Vector128UnusedTest<ushort>.VectorUnused(3, 2) != Pass) returnVal = Fail;
54         if (Vector128UnusedTest<byte>.VectorUnused(3, 2) != Pass) returnVal = Fail;
55         if (Vector128UnusedTest<short>.VectorUnused(3, 2) != Pass) returnVal = Fail;
56         if (Vector128UnusedTest<sbyte>.VectorUnused(3, 2) != Pass) returnVal = Fail;
57         if (Environment.Is64BitProcess)
58         {
59             if (Vector128UnusedTest<long>.VectorUnused(3, 2) != Pass) returnVal = Fail;
60             if (Vector128UnusedTest<ulong>.VectorUnused(3, 2) != Pass) returnVal = Fail;
61         }
62
63         if (Vector256UnusedTest<float>.VectorUnused(3f, 2f) != Pass) returnVal = Fail;
64         if (Vector256UnusedTest<double>.VectorUnused(3, 2) != Pass) returnVal = Fail;
65         if (Vector256UnusedTest<int>.VectorUnused(3, 2) != Pass) returnVal = Fail;
66         if (Vector256UnusedTest<uint>.VectorUnused(3, 2) != Pass) returnVal = Fail;
67         if (Vector256UnusedTest<ushort>.VectorUnused(3, 2) != Pass) returnVal = Fail;
68         if (Vector256UnusedTest<byte>.VectorUnused(3, 2) != Pass) returnVal = Fail;
69         if (Vector256UnusedTest<short>.VectorUnused(3, 2) != Pass) returnVal = Fail;
70         if (Vector256UnusedTest<sbyte>.VectorUnused(3, 2) != Pass) returnVal = Fail;
71         if (Environment.Is64BitProcess)
72         {
73             if (Vector256UnusedTest<long>.VectorUnused(3, 2) != Pass) returnVal = Fail;
74             if (Vector256UnusedTest<ulong>.VectorUnused(3, 2) != Pass) returnVal = Fail;
75         }
76         return returnVal;
77     }
78 }