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.
6 using System.Runtime.Intrinsics;
8 namespace System.Runtime.Intrinsics.X86
11 /// This class provides access to Intel BMI1 hardware instructions via intrinsics
14 public abstract class Bmi1
18 public static bool IsSupported { get => IsSupported; }
20 public abstract class X64
24 public static bool IsSupported { get => IsSupported; }
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
31 public static ulong AndNot(ulong left, ulong right) => AndNot(left, right);
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
38 public static ulong BitFieldExtract(ulong value, byte start, byte length) => BitFieldExtract(value, start, length);
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
45 public static ulong BitFieldExtract(ulong value, ushort control) => BitFieldExtract(value, control);
48 /// unsigned __int64 _blsi_u64 (unsigned __int64 a)
50 /// This intrinisc is only available on 64-bit processes
52 public static ulong ExtractLowestSetBit(ulong value) => ExtractLowestSetBit(value);
55 /// unsigned __int64 _blsmsk_u64 (unsigned __int64 a)
56 /// BLSMSK reg, reg/m64
57 /// This intrinisc is only available on 64-bit processes
59 public static ulong GetMaskUpToLowestSetBit(ulong value) => GetMaskUpToLowestSetBit(value);
62 /// unsigned __int64 _blsr_u64 (unsigned __int64 a)
64 /// This intrinisc is only available on 64-bit processes
66 public static ulong ResetLowestSetBit(ulong value) => ResetLowestSetBit(value);
69 /// __int64 _mm_tzcnt_64 (unsigned __int64 a)
70 /// TZCNT reg, reg/m64
71 /// This intrinisc is only available on 64-bit processes
73 public static ulong TrailingZeroCount(ulong value) => TrailingZeroCount(value);
77 /// unsigned int _andn_u32 (unsigned int a, unsigned int b)
78 /// ANDN r32a, r32b, reg/m32
80 public static uint AndNot(uint left, uint right) => AndNot(left, right);
83 /// unsigned int _bextr_u32 (unsigned int a, unsigned int start, unsigned int len)
84 /// BEXTR r32a, reg/m32, r32b
86 public static uint BitFieldExtract(uint value, byte start, byte length) => BitFieldExtract(value, start, length);
89 /// unsigned int _bextr2_u32 (unsigned int a, unsigned int control)
90 /// BEXTR r32a, reg/m32, r32b
92 public static uint BitFieldExtract(uint value, ushort control) => BitFieldExtract(value, control);
95 /// unsigned int _blsi_u32 (unsigned int a)
98 public static uint ExtractLowestSetBit(uint value) => ExtractLowestSetBit(value);
101 /// unsigned int _blsmsk_u32 (unsigned int a)
102 /// BLSMSK reg, reg/m32
104 public static uint GetMaskUpToLowestSetBit(uint value) => GetMaskUpToLowestSetBit(value);
107 /// unsigned int _blsr_u32 (unsigned int a)
108 /// BLSR reg, reg/m32
110 public static uint ResetLowestSetBit(uint value) => ResetLowestSetBit(value);
113 /// int _mm_tzcnt_32 (unsigned int a)
114 /// TZCNT reg, reg/m32
116 public static uint TrailingZeroCount(uint value) => TrailingZeroCount(value);