Skip to content

Commit 64f03ac

Browse files
authored
Don't require AVX512 for 256-bit VAES intrinsics (#1348)
1 parent e0cee8f commit 64f03ac

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

crates/core_arch/src/x86/avx512vaes.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern "C" {
3838
///
3939
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_aesenc_epi128)
4040
#[inline]
41-
#[target_feature(enable = "avx512vaes,avx512vl")]
41+
#[target_feature(enable = "avx512vaes")]
4242
#[cfg_attr(test, assert_instr(vaesenc))]
4343
pub unsafe fn _mm256_aesenc_epi128(a: __m256i, round_key: __m256i) -> __m256i {
4444
aesenc_256(a, round_key)
@@ -49,7 +49,7 @@ pub unsafe fn _mm256_aesenc_epi128(a: __m256i, round_key: __m256i) -> __m256i {
4949
///
5050
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_aesenclast_epi128)
5151
#[inline]
52-
#[target_feature(enable = "avx512vaes,avx512vl")]
52+
#[target_feature(enable = "avx512vaes")]
5353
#[cfg_attr(test, assert_instr(vaesenclast))]
5454
pub unsafe fn _mm256_aesenclast_epi128(a: __m256i, round_key: __m256i) -> __m256i {
5555
aesenclast_256(a, round_key)
@@ -60,7 +60,7 @@ pub unsafe fn _mm256_aesenclast_epi128(a: __m256i, round_key: __m256i) -> __m256
6060
///
6161
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_aesdec_epi128)
6262
#[inline]
63-
#[target_feature(enable = "avx512vaes,avx512vl")]
63+
#[target_feature(enable = "avx512vaes")]
6464
#[cfg_attr(test, assert_instr(vaesdec))]
6565
pub unsafe fn _mm256_aesdec_epi128(a: __m256i, round_key: __m256i) -> __m256i {
6666
aesdec_256(a, round_key)
@@ -71,7 +71,7 @@ pub unsafe fn _mm256_aesdec_epi128(a: __m256i, round_key: __m256i) -> __m256i {
7171
///
7272
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_aesdeclast_epi128)
7373
#[inline]
74-
#[target_feature(enable = "avx512vaes,avx512vl")]
74+
#[target_feature(enable = "avx512vaes")]
7575
#[cfg_attr(test, assert_instr(vaesdeclast))]
7676
pub unsafe fn _mm256_aesdeclast_epi128(a: __m256i, round_key: __m256i) -> __m256i {
7777
aesdeclast_256(a, round_key)

crates/stdarch-verify/tests/x86-intel.rs

+6
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,12 @@ fn matches(rust: &Function, intel: &Intrinsic) -> Result<(), String> {
471471
continue;
472472
}
473473

474+
// Some AMD CPUs support VAES without AVX512, even though the Intel
475+
// documentation states that those instructions require AVX512VL.
476+
if *cpuid == "AVX512VL" && intel.cpuid.contains(&"VAES".to_string()) {
477+
continue;
478+
}
479+
474480
let cpuid = cpuid
475481
.chars()
476482
.flat_map(|c| c.to_lowercase())

0 commit comments

Comments
 (0)