This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ComputeCrc32, ComputeCrc32C (#27421)
- Loading branch information
Showing
3 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...System.Private.CoreLib/shared/System/Runtime/Intrinsics/Arm/Crc32.PlatformNotSupported.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
namespace System.Runtime.Intrinsics.Arm | ||
{ | ||
/// <summary> | ||
/// This class provides access to the ARM Crc32 hardware instructions via intrinsics | ||
/// </summary> | ||
[Intrinsic] | ||
[CLSCompliant(false)] | ||
public abstract class Crc32 : ArmBase | ||
{ | ||
internal Crc32() { } | ||
|
||
public static new bool IsSupported { [Intrinsic] get { return false; } } | ||
|
||
[Intrinsic] | ||
public new abstract class Arm64 : ArmBase.Arm64 | ||
{ | ||
internal Arm64() { } | ||
|
||
public static new bool IsSupported { [Intrinsic] get { return false; } } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32d (uint32_t a, uint64_t b) | ||
/// A64: CRC32X Wd, Wn, Xm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, ulong data) { throw new PlatformNotSupportedException(); } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32cd (uint32_t a, uint64_t b) | ||
/// A64: CRC32CX Wd, Wn, Xm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, ulong data) { throw new PlatformNotSupportedException(); } | ||
} | ||
|
||
/// <summary> | ||
/// uint32_t __crc32b (uint32_t a, uint8_t b) | ||
/// A32: CRC32B Rd, Rn, Rm | ||
/// A64: CRC32B Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, byte data) { throw new PlatformNotSupportedException(); } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32h (uint32_t a, uint16_t b) | ||
/// A32: CRC32H Rd, Rn, Rm | ||
/// A64: CRC32H Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, ushort data) { throw new PlatformNotSupportedException(); } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32w (uint32_t a, uint32_t b) | ||
/// A32: CRC32W Rd, Rn, Rm | ||
/// A64: CRC32W Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, uint data) { throw new PlatformNotSupportedException(); } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32cb (uint32_t a, uint8_t b) | ||
/// A32: CRC32CB Rd, Rn, Rm | ||
/// A64: CRC32CB Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, byte data) { throw new PlatformNotSupportedException(); } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32ch (uint32_t a, uint16_t b) | ||
/// A32: CRC32CH Rd, Rn, Rm | ||
/// A64: CRC32CH Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, ushort data) { throw new PlatformNotSupportedException(); } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32cw (uint32_t a, uint32_t b) | ||
/// A32: CRC32CW Rd, Rn, Rm | ||
/// A64: CRC32CW Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, uint data) { throw new PlatformNotSupportedException(); } | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Arm/Crc32.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
namespace System.Runtime.Intrinsics.Arm | ||
{ | ||
/// <summary> | ||
/// This class provides access to the ARM Crc32 hardware instructions via intrinsics | ||
/// </summary> | ||
[Intrinsic] | ||
[CLSCompliant(false)] | ||
public abstract class Crc32 : ArmBase | ||
{ | ||
internal Crc32() { } | ||
|
||
public static new bool IsSupported { get => IsSupported; } | ||
|
||
[Intrinsic] | ||
public new abstract class Arm64 : ArmBase.Arm64 | ||
{ | ||
internal Arm64() { } | ||
|
||
public static new bool IsSupported { get => IsSupported; } | ||
|
||
/// <summary> | ||
/// uint32_t __crc32d (uint32_t a, uint64_t b) | ||
/// A64: CRC32X Wd, Wn, Xm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, ulong data) => ComputeCrc32(crc, data); | ||
|
||
/// <summary> | ||
/// uint32_t __crc32cd (uint32_t a, uint64_t b) | ||
/// A64: CRC32CX Wd, Wn, Xm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, ulong data) => ComputeCrc32C(crc, data); | ||
} | ||
|
||
/// <summary> | ||
/// uint32_t __crc32b (uint32_t a, uint8_t b) | ||
/// A32: CRC32B Rd, Rn, Rm | ||
/// A64: CRC32B Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, byte data) => ComputeCrc32(crc, data); | ||
|
||
/// <summary> | ||
/// uint32_t __crc32h (uint32_t a, uint16_t b) | ||
/// A32: CRC32H Rd, Rn, Rm | ||
/// A64: CRC32H Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, ushort data) => ComputeCrc32(crc, data); | ||
|
||
/// <summary> | ||
/// uint32_t __crc32w (uint32_t a, uint32_t b) | ||
/// A32: CRC32W Rd, Rn, Rm | ||
/// A64: CRC32W Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32(uint crc, uint data) => ComputeCrc32(crc, data); | ||
|
||
/// <summary> | ||
/// uint32_t __crc32cb (uint32_t a, uint8_t b) | ||
/// A32: CRC32CB Rd, Rn, Rm | ||
/// A64: CRC32CB Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, byte data) => ComputeCrc32C(crc, data); | ||
|
||
/// <summary> | ||
/// uint32_t __crc32ch (uint32_t a, uint16_t b) | ||
/// A32: CRC32CH Rd, Rn, Rm | ||
/// A64: CRC32CH Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, ushort data) => ComputeCrc32C(crc, data); | ||
|
||
/// <summary> | ||
/// uint32_t __crc32cw (uint32_t a, uint32_t b) | ||
/// A32: CRC32CW Rd, Rn, Rm | ||
/// A64: CRC32CW Wd, Wn, Wm | ||
/// </summary> | ||
public static uint ComputeCrc32C(uint crc, uint data) => ComputeCrc32C(crc, data); | ||
} | ||
} |