Skip to content

[API Proposal]: SVE AES: change arg names and types #131204

Description

@a74nh

The following was approved for SVE AES in #94423

namespace System.Runtime.Intrinsics.Arm;

/// VectorT Summary
public abstract class SveAes : AdvSimd /// Feature: FEAT_SVE_AES
{

  public static unsafe Vector<byte> InverseMixColumns(Vector<byte> value); // AESIMC

  public static unsafe Vector<byte> MixColumns(Vector<byte> value); // AESMC

  public static unsafe Vector<byte> Decrypt(Vector<byte> left, Vector<byte> right); // AESD

  public static unsafe Vector<byte> Encrypt(Vector<byte> left, Vector<byte> right); // AESE

  public static unsafe Vector<ulong> PolynomialMultiplyWideningEven(Vector<ulong> left, Vector<ulong> right); // PMULLB

  public static unsafe Vector<ulong> PolynomialMultiplyWideningOdd(Vector<ulong> left, Vector<ulong> right); // PMULLT
}
  /// total method signatures: 6

There are three issues with these APIs

1:
The APIs do no need to be marked unsafe

2:
The names of the Decrypt/Encrypt arguments should be changed to match the existing Advsimd AES APIs:

  public static Vector<byte> Decrypt(Vector<byte> value, Vector<byte> roundKey); // AESD
  public static Vector<byte> Encrypt(Vector<byte> value, Vector<byte> roundKey); // AESE

3:
The argument types for the Polynomial functions are wrong. The forms of the instructions are:

PMULLB Zresult.H, Zop1.B, Zop2.B
PMULLB Zresult.D, Zop1.S, Zop2.S
PMULLT Zresult.H, Zop1.B, Zop2.B
PMULLT Zresult.D, Zop1.S, Zop2.S

Therefore the APIs should be:

public static Vector<ushort> PolynomialMultiplyWideningEven(Vector<byte> left, Vector<byte> right)
public static Vector<ulong> PolynomialMultiplyWideningEven(Vector<uint> left, Vector<uint> right)
public static Vector<ushort> PolynomialMultiplyWideningOdd(Vector<byte> left, Vector<byte> right)
public static Vector<ulong> PolynomialMultiplyWideningOdd(Vector<uint> left, Vector<uint> right)

These changes have been made in the implementation in #130859


The final suggested API is:

namespace System.Runtime.Intrinsics.Arm;

/// VectorT Summary
public abstract class SveAes : AdvSimd /// Feature: FEAT_SVE_AES
{

  public static Vector<byte> InverseMixColumns(Vector<byte> value); // AESIMC

  public static Vector<byte> MixColumns(Vector<byte> value); // AESMC

  public static Vector<byte> Decrypt(Vector<byte> value, Vector<byte> roundKey); // AESD

  public static Vector<byte> Encrypt(Vector<byte> value, Vector<byte> roundKey); // AESE

  public static Vector<ushort> PolynomialMultiplyWideningEven(Vector<byte> left, Vector<byte> right); // PMULLB

  public static Vector<ulong> PolynomialMultiplyWideningEven(Vector<uint> left, Vector<uint> right); // PMULLB

  public static Vector<ushort> PolynomialMultiplyWideningOdd(Vector<byte> left, Vector<byte> right); // PMULLT

  public static Vector<ulong> PolynomialMultiplyWideningOdd(Vector<uint> left, Vector<uint> right); // PMULLT

}
  /// total method signatures: 8

Activity

  1. dotnet-policy-service commented on Jul 22, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
    See info in area-owners.md if you want to be subscribed.

  2. added
    api-ready-for-reviewAPI is ready for review, it is NOT ready for implementation
    arm-sveWork related to arm64 SVE/SVE2 support
    and removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 22, 2026
  3. added this to the 11.0.0 milestone on Jul 22, 2026
  4. bartonjs commented on Aug 11, 2026

    @bartonjs
    Member

    Video

    Looks good as proposed.

    namespace System.Runtime.Intrinsics.Arm;
    
    public abstract class SveAes : AdvSimd /// Feature: FEAT_SVE_AES
    {
    
      public static Vector<byte> InverseMixColumns(Vector<byte> value); // AESIMC
    
      public static Vector<byte> MixColumns(Vector<byte> value); // AESMC
    
      public static Vector<byte> Decrypt(Vector<byte> value, Vector<byte> roundKey); // AESD
    
      public static Vector<byte> Encrypt(Vector<byte> value, Vector<byte> roundKey); // AESE
    
      public static Vector<ushort> PolynomialMultiplyWideningEven(Vector<byte> left, Vector<byte> right); // PMULLB
    
      public static Vector<ulong> PolynomialMultiplyWideningEven(Vector<uint> left, Vector<uint> right); // PMULLB
    
      public static Vector<ushort> PolynomialMultiplyWideningOdd(Vector<byte> left, Vector<byte> right); // PMULLT
    
      public static Vector<ulong> PolynomialMultiplyWideningOdd(Vector<uint> left, Vector<uint> right); // PMULLT
    
    }
  5. added
    api-approvedAPI was approved in API review, it can be implemented
    and removed
    api-ready-for-reviewAPI is ready for review, it is NOT ready for implementation
    on Aug 11, 2026
  6. tannergooding commented on Aug 11, 2026

    @tannergooding
    Member

    @a74nh this is already implemented and so was just signing-off on the consistency improvements and can be closed, right?

  7. a74nh commented on Aug 12, 2026

    @a74nh
    ContributorAuthor

    @a74nh this is already implemented and so was just signing-off on the consistency improvements and can be closed, right?

    I should have removed the ready-to-review tag last week.

    From the reviews on #130859, the following needs to change:

    • The PolynomialMultiplyWidenings are technically part of FEAT_SVE_PMULL128 so need moving to a SvePmull128.
    • Vector<ulong> is correct for PolynomialMultiplyWidening - the byte/uint versions are the SVE2 variations.

    I'd recommend we discuss in #130859

  8. locked and limited conversation to collaborators on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions