Ejemplo n.º 1
0
        public override MethodIL GetMethodIL(MethodDesc method)
        {
            if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(method) &&
                HardwareIntrinsicHelpers.IsIsSupportedMethod(method))
            {
                MethodIL methodIL = HardwareIntrinsicHelpers.EmitIsSupportedIL(method, _hardwareIntrinsicFlags);
                if (methodIL != null)
                {
                    return(methodIL);
                }
            }

            return(base.GetMethodIL(method));
        }
Ejemplo n.º 2
0
        public override MethodIL GetMethodIL(MethodDesc method)
        {
            TypeDesc owningType  = method.OwningType;
            string   intrinsicId = InstructionSetSupport.GetHardwareIntrinsicId(TypeSystemContext.Target.Architecture, owningType);

            if (!string.IsNullOrEmpty(intrinsicId) &&
                HardwareIntrinsicHelpers.IsIsSupportedMethod(method))
            {
                InstructionSet instructionSet = _instructionSetMap[intrinsicId];

                // If this is an instruction set that is optimistically supported, but is not one of the
                // intrinsics that are known to be always available, emit IL that checks the support level
                // at runtime.
                if (!InstructionSetSupport.IsInstructionSetSupported(instructionSet) &&
                    InstructionSetSupport.OptimisticFlags.HasInstructionSet(instructionSet))
                {
                    return(HardwareIntrinsicHelpers.EmitIsSupportedIL(method, _hardwareIntrinsicFlags, instructionSet));
                }
            }

            return(base.GetMethodIL(method));
        }