Hardware intrinsic IsSupported checks may differ for nested types

Checking <Isa>.X64.IsSupported, where <Isa> refers to the classes in the System.Runtime.Intrinsics.X86 namespace, may now produce a different result to previous versions of .NET.

Tip

ISA stands for industry standard architecture.

Version introduced

5.0

Change description

In previous versions of .NET, some of the System.Runtime.Intrinsics.X86 hardware-intrinsic types, for example, System.Runtime.Intrinsics.X86.Aes, didn't expose a nested X64 class. For these types, calling <Isa>.X64.IsSupported resolved to an IsSupported property on a nested X64 class of a parent class of <Isa>. This meant that the property could return true even when <Isa>.IsSupported returns false.

In .NET 5 and later versions, all of the System.Runtime.Intrinsics.X86 types expose a nested X64 class that appropriately reports support. This ensures that the general hierarchy remains correct, and that if <Isa>.X64.IsSupported is true, then <Isa>.IsSupported can also be assumed to be true.

Reason for change

It was intended that if <Isa>.X64.IsSupported is true, <Isa>.IsSupported is also implied to be true. However, due to how member resolution works in C#, classes that didn't have a nested X64 class exposed a situation where this wasn't always the case and led to bugs in user code.

If necessary, adjust code that checks IsSupported to check for the appropriate ISA.

Affected APIs