Esempio n. 1
0
        private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelper(TargetArchitecture architecture, InstructionSetFlags input)
        {
            InstructionSetFlags oldflags    = input;
            InstructionSetFlags resultflags = input;

            do
            {
                oldflags = resultflags;
                switch (architecture)
                {
                case TargetArchitecture.ARM64:
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase_Arm64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd_Arm64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_Crc32_Arm64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_Crc32);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_Aes);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_Crc32);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_Sha1);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
                    {
                        resultflags.AddInstructionSet(InstructionSet.ARM64_Sha256);
                    }
                    break;

                case TargetArchitecture.X64:
                    if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_X86Base);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE41_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE41);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE42);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_BMI1_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_BMI1);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_BMI2_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_BMI2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_LZCNT_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_LZCNT);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_POPCNT_X64))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_POPCNT);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE3);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE3))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSSE3);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSSE3))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE41);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE41))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_SSE42);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_AVX);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_AVX2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_AES);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_BMI1);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_BMI2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_FMA);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_POPCNT);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X64_Vector256);
                    }
                    break;

                case TargetArchitecture.X86:
                    if (resultflags.HasInstructionSet(InstructionSet.X86_X86Base))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_SSE);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_SSE2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE2))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_SSE3);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE3))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_SSSE3);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSSE3))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_SSE41);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE41))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_SSE42);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE42))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_AVX);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_AVX2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE2))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_AES);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_BMI1);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_BMI2);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_FMA);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE2))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_SSE42))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_POPCNT);
                    }
                    if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
                    {
                        resultflags.AddInstructionSet(InstructionSet.X86_Vector256);
                    }
                    break;
                }
            } while (!oldflags.Equals(resultflags));
            return(resultflags);
        }
Esempio n. 2
0
 public void Remove(InstructionSetFlags other)
 {
     _flags &= ~other._flags;
 }
Esempio n. 3
0
 public void Add(InstructionSetFlags other)
 {
     _flags |= other._flags;
 }
Esempio n. 4
0
 public void IntersectionWith(InstructionSetFlags other)
 {
     _flags &= other._flags;
 }
Esempio n. 5
0
 public bool Equals(InstructionSetFlags other)
 {
     return(_flags == other._flags);
 }