Skip to content

Stabilize keylocker intrinsics and runtime detection #1795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
22 changes: 11 additions & 11 deletions crates/core_arch/src/x86/kl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ unsafe extern "unadjusted" {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadiwkey)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(loadiwkey))]
pub unsafe fn _mm_loadiwkey(
control: u32,
Expand All @@ -153,7 +153,7 @@ pub unsafe fn _mm_loadiwkey(
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_encodekey128_u32)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(encodekey128))]
pub unsafe fn _mm_encodekey128_u32(key_params: u32, key: __m128i, handle: *mut u8) -> u32 {
let EncodeKey128Output(control, key0, key1, key2, _, _, _) = encodekey128(key_params, key);
Expand All @@ -176,7 +176,7 @@ pub unsafe fn _mm_encodekey128_u32(key_params: u32, key: __m128i, handle: *mut u
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_encodekey256_u32)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(encodekey256))]
pub unsafe fn _mm_encodekey256_u32(
key_params: u32,
Expand All @@ -198,7 +198,7 @@ pub unsafe fn _mm_encodekey256_u32(
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesenc128kl_u8)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesenc128kl))]
pub unsafe fn _mm_aesenc128kl_u8(output: *mut __m128i, input: __m128i, handle: *const u8) -> u8 {
let AesOutput(status, result) = aesenc128kl(input, handle);
Expand All @@ -214,7 +214,7 @@ pub unsafe fn _mm_aesenc128kl_u8(output: *mut __m128i, input: __m128i, handle: *
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdec128kl_u8)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesdec128kl))]
pub unsafe fn _mm_aesdec128kl_u8(output: *mut __m128i, input: __m128i, handle: *const u8) -> u8 {
let AesOutput(status, result) = aesdec128kl(input, handle);
Expand All @@ -230,7 +230,7 @@ pub unsafe fn _mm_aesdec128kl_u8(output: *mut __m128i, input: __m128i, handle: *
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesenc256kl_u8)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesenc256kl))]
pub unsafe fn _mm_aesenc256kl_u8(output: *mut __m128i, input: __m128i, handle: *const u8) -> u8 {
let AesOutput(status, result) = aesenc256kl(input, handle);
Expand All @@ -246,7 +246,7 @@ pub unsafe fn _mm_aesenc256kl_u8(output: *mut __m128i, input: __m128i, handle: *
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdec256kl_u8)
#[inline]
#[target_feature(enable = "kl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesdec256kl))]
pub unsafe fn _mm_aesdec256kl_u8(output: *mut __m128i, input: __m128i, handle: *const u8) -> u8 {
let AesOutput(status, result) = aesdec256kl(input, handle);
Expand All @@ -262,7 +262,7 @@ pub unsafe fn _mm_aesdec256kl_u8(output: *mut __m128i, input: __m128i, handle: *
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesencwide128kl_u8)
#[inline]
#[target_feature(enable = "widekl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesencwide128kl))]
pub unsafe fn _mm_aesencwide128kl_u8(
output: *mut __m128i,
Expand All @@ -285,7 +285,7 @@ pub unsafe fn _mm_aesencwide128kl_u8(
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdecwide128kl_u8)
#[inline]
#[target_feature(enable = "widekl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesdecwide128kl))]
pub unsafe fn _mm_aesdecwide128kl_u8(
output: *mut __m128i,
Expand All @@ -308,7 +308,7 @@ pub unsafe fn _mm_aesdecwide128kl_u8(
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesencwide256kl_u8)
#[inline]
#[target_feature(enable = "widekl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesencwide256kl))]
pub unsafe fn _mm_aesencwide256kl_u8(
output: *mut __m128i,
Expand All @@ -331,7 +331,7 @@ pub unsafe fn _mm_aesencwide256kl_u8(
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdecwide256kl_u8)
#[inline]
#[target_feature(enable = "widekl")]
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
#[cfg_attr(test, assert_instr(aesdecwide256kl))]
pub unsafe fn _mm_aesdecwide256kl_u8(
output: *mut __m128i,
Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,5 +772,5 @@ mod avx512fp16;
pub use self::avx512fp16::*;

mod kl;
#[unstable(feature = "keylocker_x86", issue = "134813")]
#[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")]
pub use self::kl::*;
4 changes: 2 additions & 2 deletions crates/std_detect/src/detect/arch/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ features! {
/// XSAVEC (Save Processor Extended States Compacted)
@FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] cmpxchg16b: "cmpxchg16b";
/// CMPXCH16B (16-byte compare-and-swap instruction)
@FEATURE: #[unstable(feature = "keylocker_x86", issue = "134813")] kl: "kl";
@FEATURE: #[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")] kl: "kl";
/// Intel Key Locker
@FEATURE: #[unstable(feature = "keylocker_x86", issue = "134813")] widekl: "widekl";
@FEATURE: #[stable(feature = "keylocker_x86", since = "CURRENT_RUSTC_VERSION")] widekl: "widekl";
/// Intel Key Locker Wide
@FEATURE: #[stable(feature = "simd_x86_adx", since = "1.33.0")] adx: "adx";
/// ADX, Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
Expand Down