dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.66k stars 4.57k forks source link

[API Proposal]: Arm64: FEAT_SVE_SM4 #94426

Open a74nh opened 8 months ago

a74nh commented 8 months ago
namespace System.Runtime.Intrinsics.Arm

/// VectorT Summary
public abstract class SveSm4 : AdvSimd /// Feature: FEAT_SVE_SM4
{

  public static unsafe Vector<uint> Sm4EncryptionAndDecryption(Vector<uint> left, Vector<uint> right); // SM4E

  public static unsafe Vector<uint> Sm4KeyUpdates(Vector<uint> left, Vector<uint> right); // SM4EKEY

  /// total method signatures: 2

}

/// Full API
public abstract class SveSm4 : AdvSimd /// Feature: FEAT_SVE_SM4
{
    /// Sm4EncryptionAndDecryption : SM4 encryption and decryption

    /// svuint32_t svsm4e[_u32](svuint32_t op1, svuint32_t op2) : "SM4E Ztied1.S, Ztied1.S, Zop2.S"
  public static unsafe Vector<uint> Sm4EncryptionAndDecryption(Vector<uint> left, Vector<uint> right);

    /// Sm4KeyUpdates : SM4 key updates

    /// svuint32_t svsm4ekey[_u32](svuint32_t op1, svuint32_t op2) : "SM4EKEY Zresult.S, Zop1.S, Zop2.S"
  public static unsafe Vector<uint> Sm4KeyUpdates(Vector<uint> left, Vector<uint> right);

  /// total method signatures: 2
  /// total method names:      2
}

  /// Total ACLE covered across API:      2
ghost commented 8 months ago

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

Issue Details
```csharp namespace System.Runtime.Intrinsics.Arm /// VectorT Summary public abstract class SveSm4 : AdvSimd /// Feature: FEAT_SVE_SM4 { public static unsafe Vector Sm4EncryptionAndDecryption(Vector left, Vector right); // SM4E public static unsafe Vector Sm4KeyUpdates(Vector left, Vector right); // SM4EKEY /// total method signatures: 2 } /// Full API public abstract class SveSm4 : AdvSimd /// Feature: FEAT_SVE_SM4 { /// Sm4EncryptionAndDecryption : SM4 encryption and decryption /// svuint32_t svsm4e[_u32](svuint32_t op1, svuint32_t op2) : "SM4E Ztied1.S, Ztied1.S, Zop2.S" public static unsafe Vector Sm4EncryptionAndDecryption(Vector left, Vector right); /// Sm4KeyUpdates : SM4 key updates /// svuint32_t svsm4ekey[_u32](svuint32_t op1, svuint32_t op2) : "SM4EKEY Zresult.S, Zop1.S, Zop2.S" public static unsafe Vector Sm4KeyUpdates(Vector left, Vector right); /// total method signatures: 2 /// total method names: 2 } /// Total ACLE covered across API: 2 ```
Author: a74nh
Assignees: -
Labels: `area-System.Runtime.Intrinsics`
Milestone: -
a74nh commented 8 months ago

This contributes to https://github.com/dotnet/runtime/issues/93095

It covers all of the instructions in FEAT_SVE_SM4. This list was auto generated from the C ACLE for SVE, and is in three parts:

The methods list reduced down to Vector versions. All possible varaints of T are given above the method. The complete list of all methods. The corresponding ACLE methods and SVE instructions are given above the method. All rejected ACLE methods. These are methods we have agreed that do not need including in C#. Where possible, existing C# naming conventions have been matched.

Many of the C functions include predicate argument(s), of type svbool_t as the first argument. These are missing from the C# method. It is expected that the Jit will create predicates where required, or combine with uses of conditionalSelect(). For more discussion see https://github.com/dotnet/runtime/issues/88140 comment.