Edit

Share via


Arm64 SVE nonfaulting loads require mask parameter

All Arm64 SVE nonfaulting load APIs have been updated to include a mask parameter in the first position. This change affects all methods with LoadVector*NonFaulting in their name in the System.Runtime.Intrinsics.Arm.Sve class.

Version introduced

.NET 10 Preview 7

Previous behavior

Previously, nonfaulting load APIs took only an address parameter and loaded a full vector:

Vector<short> result = Sve.LoadVectorByteNonFaultingZeroExtendToInt16(address);

To do nonfaulting load with masked-out elements, you had to use ConditionalSelect:

Vector<short> maskedResult = Sve.ConditionalSelect(
    mask,
    Sve.LoadVectorByteNonFaultingZeroExtendToInt16(address),
    zero);

New behavior

Starting in .NET 10, nonfaulting load APIs require a mask parameter as the first argument.

To do a nonfaulting load for all elements, create and pass a true mask: Sve.LoadVector*NonFaulting*(Sve.CreateTrueMask*(), addr);

Type of breaking change

This change can affect binary compatibility and source compatibility.

Reason for change

This change was necessary because a nonfaulting load updates the first fault register (FFR) depending on which vector lanes are loaded. The standard conversion of ConditionalSelect(mask, LoadVectorNonFaulting(addr), zero) to a masked load can't be used because it doesn't properly handle the FFR register state. Therefore, the only valid way to implement a masked nonfaulting load is by exposing it as a dedicated API.

  • For existing uses of Sve.ConditionalSelect(mask, Sve.LoadVector*NonFaulting*(addr), zero), replace them with Sve.LoadVector*NonFaulting*(mask, addr).
  • Update other uses of nonfaulting loads to include a true mask: Sve.LoadVector*NonFaulting*(Sve.CreateTrueMask*(), addr).

Affected APIs