Remove legacy 64-bit intrinsic APIs
[platform/upstream/coreclr.git] / src / System.Private.CoreLib / shared / System / Runtime / Intrinsics / X86 / Bmi1.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 using System;
6 using System.Runtime.Intrinsics;
7
8 namespace System.Runtime.Intrinsics.X86
9 {
10     /// <summary>
11     /// This class provides access to Intel BMI1 hardware instructions via intrinsics
12     /// </summary>
13     [CLSCompliant(false)]
14     public abstract class Bmi1
15     {
16         internal Bmi1() { }
17
18         public static bool IsSupported { get => IsSupported; }
19
20         public abstract class X64
21         {
22             internal X64() { }
23
24             public static bool IsSupported { get => IsSupported; }
25
26             /// <summary>
27             /// unsigned __int64 _andn_u64 (unsigned __int64 a, unsigned __int64 b)
28             ///   ANDN r64a, r64b, reg/m64
29             /// This intrinisc is only available on 64-bit processes
30             /// </summary>
31             public static ulong AndNot(ulong left, ulong right) => AndNot(left, right);
32
33             /// <summary>
34             /// unsigned __int64 _bextr_u64 (unsigned __int64 a, unsigned int start, unsigned int len)
35             ///   BEXTR r64a, reg/m64, r64b
36             /// This intrinisc is only available on 64-bit processes
37             /// </summary>
38             public static ulong BitFieldExtract(ulong value, byte start, byte length) => BitFieldExtract(value, start, length);
39
40             /// <summary>
41             /// unsigned __int64 _bextr2_u64 (unsigned __int64 a, unsigned __int64 control)
42             ///   BEXTR r64a, reg/m64, r64b
43             /// This intrinisc is only available on 64-bit processes
44             /// </summary>
45             public static ulong BitFieldExtract(ulong value, ushort control) => BitFieldExtract(value, control);
46
47             /// <summary>
48             /// unsigned __int64 _blsi_u64 (unsigned __int64 a)
49             ///   BLSI reg, reg/m64
50             /// This intrinisc is only available on 64-bit processes
51             /// </summary>
52             public static ulong ExtractLowestSetBit(ulong value) => ExtractLowestSetBit(value);
53
54             /// <summary>
55             /// unsigned __int64 _blsmsk_u64 (unsigned __int64 a)
56             ///   BLSMSK reg, reg/m64
57             /// This intrinisc is only available on 64-bit processes
58             /// </summary>
59             public static ulong GetMaskUpToLowestSetBit(ulong value) => GetMaskUpToLowestSetBit(value);
60
61             /// <summary>
62             /// unsigned __int64 _blsr_u64 (unsigned __int64 a)
63             ///   BLSR reg, reg/m64
64             /// This intrinisc is only available on 64-bit processes
65             /// </summary>
66             public static ulong ResetLowestSetBit(ulong value) => ResetLowestSetBit(value);
67
68             /// <summary>
69             /// __int64 _mm_tzcnt_64 (unsigned __int64 a)
70             ///   TZCNT reg, reg/m64
71             /// This intrinisc is only available on 64-bit processes
72             /// </summary>
73             public static ulong TrailingZeroCount(ulong value) => TrailingZeroCount(value);
74         }
75
76         /// <summary>
77         /// unsigned int _andn_u32 (unsigned int a, unsigned int b)
78         ///   ANDN r32a, r32b, reg/m32
79         /// </summary>
80         public static uint AndNot(uint left, uint right) => AndNot(left, right);
81
82         /// <summary>
83         /// unsigned int _bextr_u32 (unsigned int a, unsigned int start, unsigned int len)
84         ///   BEXTR r32a, reg/m32, r32b
85         /// </summary>
86         public static uint BitFieldExtract(uint value, byte start, byte length) => BitFieldExtract(value, start, length);
87
88         /// <summary>
89         /// unsigned int _bextr2_u32 (unsigned int a, unsigned int control)
90         ///   BEXTR r32a, reg/m32, r32b
91         /// </summary>
92         public static uint BitFieldExtract(uint value, ushort control) => BitFieldExtract(value, control);
93
94         /// <summary>
95         /// unsigned int _blsi_u32 (unsigned int a)
96         ///   BLSI reg, reg/m32
97         /// </summary>
98         public static uint ExtractLowestSetBit(uint value) => ExtractLowestSetBit(value);
99
100         /// <summary>
101         /// unsigned int _blsmsk_u32 (unsigned int a)
102         ///   BLSMSK reg, reg/m32
103         /// </summary>
104         public static uint GetMaskUpToLowestSetBit(uint value) => GetMaskUpToLowestSetBit(value);
105
106         /// <summary>
107         /// unsigned int _blsr_u32 (unsigned int a)
108         ///   BLSR reg, reg/m32
109         /// </summary>
110         public static uint ResetLowestSetBit(uint value) => ResetLowestSetBit(value);
111
112         /// <summary>
113         /// int _mm_tzcnt_32 (unsigned int a)
114         ///   TZCNT reg, reg/m32
115         /// </summary>
116         public static uint TrailingZeroCount(uint value) => TrailingZeroCount(value);
117     }
118 }