Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/jit/emitarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6101,6 +6101,7 @@ void emitter::emitIns_R_R_R(instruction ins,
FALLTHROUGH;

case INS_sadalp:
case INS_sm4e:
case INS_suqadd:
case INS_uadalp:
case INS_usqadd:
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/jit/emitarm64sve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3016,6 +3016,9 @@ void emitter::emitInsSve_R_R_R(instruction ins,
emitInsSve_R_R(ins, attr, reg1, reg3, opt, sopt);
return;

case INS_sve_aesd:
case INS_sve_aese:
case INS_sve_sm4e:
case INS_sve_sqxtnt:
case INS_sve_uqxtnt:
case INS_sve_sqxtunt:
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/hwintrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,10 +1027,10 @@ static const HWIntrinsicIsaRange hwintrinsicIsaRangeArray[] = {
{ FIRST_NI_Sve, LAST_NI_Sve }, // Sve
{ FIRST_NI_Sve2, LAST_NI_Sve2 }, // Sve2
{ FIRST_NI_Sha3, LAST_NI_Sha3 }, // Sha3
{ NI_Illegal, NI_Illegal }, // Sm4
{ FIRST_NI_Sm4, LAST_NI_Sm4 }, // Sm4
{ NI_Illegal, NI_Illegal }, // SveAes
{ FIRST_NI_SveSha3, LAST_NI_SveSha3 }, // SveSha3
{ NI_Illegal, NI_Illegal }, // SveSm4
{ FIRST_NI_SveSm4, LAST_NI_SveSm4 }, // SveSm4
{ FIRST_NI_ArmBase_Arm64, LAST_NI_ArmBase_Arm64 }, // ArmBase_Arm64
{ FIRST_NI_AdvSimd_Arm64, LAST_NI_AdvSimd_Arm64 }, // AdvSimd_Arm64
{ NI_Illegal, NI_Illegal }, // Aes_Arm64
Expand Down
11 changes: 10 additions & 1 deletion src/coreclr/jit/hwintrinsiclistarm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ HARDWARE_INTRINSIC(Sha256, ScheduleUpdate1,

// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// ISA Function name SIMD size NumArg EncodesExtraTypeArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// Sha3
#define FIRST_NI_Sha3 NI_Sha3_BitwiseClearXor
Expand All @@ -911,6 +911,15 @@ HARDWARE_INTRINSIC(Sha3, Xor,
HARDWARE_INTRINSIC(Sha3, XorRotateRight, 16, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_xar, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_HasImmediateOperand)
#define LAST_NI_Sha3 NI_Sha3_XorRotateRight

// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// ISA Function name SIMD size NumArg EncodesExtraTypeArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// Sm4
#define FIRST_NI_Sm4 NI_Sm4_Encode
HARDWARE_INTRINSIC(Sm4, Encode, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sm4e, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_HasRMWSemantics)
HARDWARE_INTRINSIC(Sm4, KeyUpdate, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sm4ekey, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_NoFlag)
#define LAST_NI_Sm4 NI_Sm4_KeyUpdate

#endif // FEATURE_HW_INTRINSIC

Expand Down
12 changes: 11 additions & 1 deletion src/coreclr/jit/hwintrinsiclistarm64sve.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,21 @@ HARDWARE_INTRINSIC(Sve2, XorRotateRight,
// ISA Function name SIMD size NumArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// Sha3
// SveSha3
#define FIRST_NI_SveSha3 NI_SveSha3_BitwiseRotateLeftBy1AndXor
HARDWARE_INTRINSIC(SveSha3, BitwiseRotateLeftBy1AndXor, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_rax1, INS_sve_rax1, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen)
#define LAST_NI_SveSha3 NI_SveSha3_BitwiseRotateLeftBy1AndXor

// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// ISA Function name SIMD size NumArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// SveSm4
#define FIRST_NI_SveSm4 NI_SveSm4_Encode
HARDWARE_INTRINSIC(SveSm4, Encode, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_sm4e, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_HasRMWSemantics)
HARDWARE_INTRINSIC(SveSm4, KeyUpdate, -1, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_sm4ekey, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable)
#define LAST_NI_SveSm4 NI_SveSm4_KeyUpdate

// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// ISA Function name SIMD size NumArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,23 @@
<type fullname="System.Runtime.Intrinsics.Arm.Sha3/Arm64">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
<type fullname="System.Runtime.Intrinsics.Arm.Sm4">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
<type fullname="System.Runtime.Intrinsics.Arm.Sm4/Arm64">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
<type fullname="System.Runtime.Intrinsics.Arm.SveSha3">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
<type fullname="System.Runtime.Intrinsics.Arm.SveSha3/Arm64">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
<type fullname="System.Runtime.Intrinsics.Arm.SveSm4">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
<type fullname="System.Runtime.Intrinsics.Arm.SveSm4/Arm64">
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
</type>
</assembly>
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -2873,10 +2873,12 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Rdm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha256.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha3.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sm4.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sve.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sve2.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha3.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\SveSha3.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\SveSm4.cs" />
</ItemGroup>
<ItemGroup Condition="'$(SupportsArmIntrinsics)' != 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\AdvSimd.PlatformNotSupported.cs" />
Expand All @@ -2887,10 +2889,12 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Rdm.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha1.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha256.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha3.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sm4.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sve.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sve2.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\Sha3.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\SveSha3.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Arm\SveSm4.PlatformNotSupported.cs" />
</ItemGroup>
<ItemGroup Condition="'$(SupportsWasmIntrinsics)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Intrinsics\Wasm\WasmBase.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace System.Runtime.Intrinsics.Arm
{
/// <summary>Provides access to the ARM Sm4 hardware instructions via intrinsics.</summary>
[CLSCompliant(false)]
public abstract class Sm4 : ArmBase
{
internal Sm4() { }

/// <summary>Gets a value that indicates whether the APIs in this class are supported.</summary>
/// <value><see langword="true" /> if the APIs are supported; otherwise, <see langword="false" />.</value>
/// <remarks>A value of <see langword="false" /> indicates that the APIs will throw <see cref="PlatformNotSupportedException" />.</remarks>
public static new bool IsSupported { [Intrinsic] get => false; }

/// <summary>Provides access to the ARM Sm4 hardware instructions, that are only available to 64-bit processes, via intrinsics.</summary>
public new abstract class Arm64 : ArmBase.Arm64
{
internal Arm64() { }

/// <summary>Gets a value that indicates whether the APIs in this class are supported.</summary>
/// <value><see langword="true" /> if the APIs are supported; otherwise, <see langword="false" />.</value>
/// <remarks>A value of <see langword="false" /> indicates that the APIs will throw <see cref="PlatformNotSupportedException" />.</remarks>
public static new bool IsSupported { get => IsSupported; }
}


// SM4 encryption and decryption

/// <summary>
/// uint32x4_t vsm4eq_u32(uint32x4_t a, uint32x4_t b)
/// SM4E Vd.4S,Vn.4S
/// </summary>
public static unsafe Vector128<uint> Encode(Vector128<uint> value, Vector128<uint> roundKeys) { throw new PlatformNotSupportedException(); }

// SM4 key updates

/// <summary>
/// uint32x4_t vsm4ekeyq_u32(uint32x4_t a, uint32x4_t b)
/// SM4EKEY Vd.4S,Vn.4S,Vm.4S
/// </summary>
public static unsafe Vector128<uint> KeyUpdate(Vector128<uint> value, Vector128<uint> constant) { throw new PlatformNotSupportedException(); }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace System.Runtime.Intrinsics.Arm
{
/// <summary>Provides access to the ARM Sm4 hardware instructions via intrinsics.</summary>
[Intrinsic]
[CLSCompliant(false)]
public abstract class Sm4 : ArmBase
{
internal Sm4() { }

/// <summary>Gets a value that indicates whether the APIs in this class are supported.</summary>
/// <value><see langword="true" /> if the APIs are supported; otherwise, <see langword="false" />.</value>
/// <remarks>A value of <see langword="false" /> indicates that the APIs will throw <see cref="PlatformNotSupportedException" />.</remarks>
public static new bool IsSupported { get => IsSupported; }

/// <summary>Provides access to the ARM Sm4 hardware instructions, that are only available to 64-bit processes, via intrinsics.</summary>
[Intrinsic]
public new abstract class Arm64 : ArmBase.Arm64
{
internal Arm64() { }

/// <summary>Gets a value that indicates whether the APIs in this class are supported.</summary>
/// <value><see langword="true" /> if the APIs are supported; otherwise, <see langword="false" />.</value>
/// <remarks>A value of <see langword="false" /> indicates that the APIs will throw <see cref="PlatformNotSupportedException" />.</remarks>
public static new bool IsSupported { get => IsSupported; }
}


// SM4 encryption and decryption

/// <summary>
/// uint32x4_t vsm4eq_u32(uint32x4_t a, uint32x4_t b)
/// SM4E Vd.4S,Vn.4S
/// </summary>
public static unsafe Vector128<uint> Encode(Vector128<uint> value, Vector128<uint> roundKeys) => Encode(value, roundKeys);

// SM4 key updates

/// <summary>
/// uint32x4_t vsm4ekeyq_u32(uint32x4_t a, uint32x4_t b)
/// SM4EKEY Vd.4S,Vn.4S,Vm.4S
/// </summary>
public static unsafe Vector128<uint> KeyUpdate(Vector128<uint> value, Vector128<uint> constant) => KeyUpdate(value, constant);

}
}
Loading
Loading