Skip to content

Commit 5af8aa8

Browse files
committed
XCr0: Add AVX as alias for YMM
Deprecate YMM Signed-off-by: Joe Richey <[email protected]>
1 parent b56649d commit 5af8aa8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/registers/xcontrol.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ bitflags! {
1919
/// Enables using MXCSR and the XMM registers
2020
/// with `XSAVE`/`XRSTOR`.
2121
///
22-
/// Must be set if [`YMM`](XCr0Flags::YMM) is set.
23-
const SSE = 1<<1;
24-
/// Enables AVX instructions and using the upper halves of the YMM registers
22+
/// Must be set if [`AVX`](XCr0Flags::AVX) is set.
23+
const SSE = 1 << 1;
24+
/// Enables AVX instructions and using the upper halves of the AVX registers
2525
/// with `XSAVE`/`XRSTOR`.
26+
const AVX = 1 << 2;
27+
/// Alias for [`AVX`](XCr0Flags::AVX)
28+
#[deprecated(since = "0.14.5", note = "use `AVX` instead")]
2629
const YMM = 1<<2;
2730
/// Enables MPX instructions and using the BND0-BND3 bound registers
2831
/// with `XSAVE`/`XRSTOR` (Intel Only).
@@ -95,10 +98,10 @@ mod x86_64 {
9598
let new_value = reserved | flags.bits();
9699

97100
assert!(flags.contains(XCr0Flags::X87), "The X87 flag must be set");
98-
if flags.contains(XCr0Flags::YMM) {
101+
if flags.contains(XCr0Flags::AVX) {
99102
assert!(
100103
flags.contains(XCr0Flags::SSE),
101-
"AVX/YMM cannot be enabled without enabling SSE"
104+
"AVX cannot be enabled without enabling SSE"
102105
);
103106
}
104107
let mpx = XCr0Flags::BNDREG | XCr0Flags::BNDCSR;
@@ -111,8 +114,8 @@ mod x86_64 {
111114
let avx512 = XCr0Flags::OPMASK | XCr0Flags::ZMM_HI256 | XCr0Flags::HI16_ZMM;
112115
if flags.intersects(avx512) {
113116
assert!(
114-
flags.contains(XCr0Flags::YMM),
115-
"AVX-512 cannot be enabled without enabling AVX/YMM"
117+
flags.contains(XCr0Flags::AVX),
118+
"AVX-512 cannot be enabled without enabling AVX"
116119
);
117120
assert!(
118121
flags.contains(avx512),

0 commit comments

Comments
 (0)