Example #1
0
        private static SuppoprtedFeatures GetArmFeatures()
        {
            SuppoprtedFeatures cpuFeatures = SuppoprtedFeatures.Arm;

            if (System.Runtime.Intrinsics.Arm.ArmBase.Arm64.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Is64Bit;
            }

            if (System.Runtime.Intrinsics.Arm.AdvSimd.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.AdvSimd;
            }

            if (System.Runtime.Intrinsics.Arm.Aes.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Aes;
            }

            if (System.Runtime.Intrinsics.Arm.Crc32.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Crc32;
            }

            if (System.Runtime.Intrinsics.Arm.Dp.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.DP;
            }

            if (System.Runtime.Intrinsics.Arm.Rdm.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Rdm;
            }

            if (System.Runtime.Intrinsics.Arm.Sha1.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sha1;
            }

            if (System.Runtime.Intrinsics.Arm.Sha256.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sha256;
            }

            return(cpuFeatures);
        }
Example #2
0
        private static SuppoprtedFeatures GetX86Features()
        {
            SuppoprtedFeatures cpuFeatures = SuppoprtedFeatures.X86;

            if (System.Runtime.Intrinsics.X86.X86Base.X64.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Is64Bit;
            }

            if (System.Runtime.Intrinsics.X86.Aes.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Aes;
            }

            if (System.Runtime.Intrinsics.X86.Avx.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Avx;
            }

            if (System.Runtime.Intrinsics.X86.Avx2.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Avx2;
            }

            if (System.Runtime.Intrinsics.X86.Bmi1.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Bmi1;
            }

            if (System.Runtime.Intrinsics.X86.Bmi2.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Bmi2;
            }

            if (System.Runtime.Intrinsics.X86.Fma.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Bmi2;
            }

            if (System.Runtime.Intrinsics.X86.Lzcnt.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Lzcnt;
            }

            if (System.Runtime.Intrinsics.X86.Pclmulqdq.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Pclmulqdq;
            }

            if (System.Runtime.Intrinsics.X86.Popcnt.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Popcnt;
            }

            if (System.Runtime.Intrinsics.X86.Sse.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sse;
            }

            if (System.Runtime.Intrinsics.X86.Sse2.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sse2;
            }

            if (System.Runtime.Intrinsics.X86.Sse3.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sse3;
            }

            if (System.Runtime.Intrinsics.X86.Sse41.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sse41;
            }

            if (System.Runtime.Intrinsics.X86.Sse42.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Sse42;
            }

            if (System.Runtime.Intrinsics.X86.Ssse3.IsSupported)
            {
                cpuFeatures = cpuFeatures | SuppoprtedFeatures.Ssse3;
            }

            return(cpuFeatures);
        }