core\stdarch\crates\core_arch\src\x86_64/
macros.rs

1//! Utility macros.
2
3// Helper macro used to trigger const eval errors when the const generic immediate value `imm` is
4// not a round number.
5#[allow(unused)]
6macro_rules! static_assert_rounding {
7    ($imm:ident) => {
8        static_assert!(
9            $imm == 4 || $imm == 8 || $imm == 9 || $imm == 10 || $imm == 11,
10            "Invalid IMM value"
11        )
12    };
13}
14
15// Helper macro used to trigger const eval errors when the const generic immediate value `imm` is
16// not a sae number.
17#[allow(unused)]
18macro_rules! static_assert_sae {
19    ($imm:ident) => {
20        static_assert!($imm == 4 || $imm == 8, "Invalid IMM value")
21    };
22}
23
24#[cfg(target_pointer_width = "32")]
25macro_rules! vps {
26    ($inst1:expr, $inst2:expr) => {
27        concat!($inst1, " [{p:e}]", $inst2)
28    };
29}
30#[cfg(target_pointer_width = "64")]
31macro_rules! vps {
32    ($inst1:expr, $inst2:expr) => {
33        concat!($inst1, " [{p}]", $inst2)
34    };
35}