about summary refs log tree commit diff
path: root/library/stdarch/crates/std_detect
diff options
context:
space:
mode:
authorCaleb Zulawski <caleb.zulawski@gmail.com>2023-01-05 12:54:07 -0500
committerGitHub <noreply@github.com>2023-01-05 17:54:07 +0000
commit39c2524e1b0ee07715d51bab1f9702b9b900a3d6 (patch)
tree65165d854433f8384527d52379ebd0a880155569 /library/stdarch/crates/std_detect
parentee060659d9b13763ba9ce8967f4cd7e36656a5e8 (diff)
downloadrust-39c2524e1b0ee07715d51bab1f9702b9b900a3d6.tar.gz
rust-39c2524e1b0ee07715d51bab1f9702b9b900a3d6.zip
Detect MOVBE (#1356)
Diffstat (limited to 'library/stdarch/crates/std_detect')
-rw-r--r--library/stdarch/crates/std_detect/src/detect/arch/x86.rs3
-rw-r--r--library/stdarch/crates/std_detect/src/detect/os/x86.rs1
-rw-r--r--library/stdarch/crates/std_detect/tests/cpu-detection.rs1
-rw-r--r--library/stdarch/crates/std_detect/tests/x86-specific.rs2
4 files changed, 7 insertions, 0 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/arch/x86.rs b/library/stdarch/crates/std_detect/src/detect/arch/x86.rs
index d0bf92d3edf..7e0af21a223 100644
--- a/library/stdarch/crates/std_detect/src/detect/arch/x86.rs
+++ b/library/stdarch/crates/std_detect/src/detect/arch/x86.rs
@@ -91,6 +91,7 @@ features! {
     /// * `"cmpxchg16b"`
     /// * `"adx"`
     /// * `"rtm"`
+    /// * `"movbe"`
     ///
     /// [docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide
     #[stable(feature = "simd_x86", since = "1.27.0")]
@@ -197,4 +198,6 @@ features! {
     /// ADX, Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
     @FEATURE: #[stable(feature = "simd_x86", since = "1.27.0")] rtm: "rtm";
     /// RTM, Intel (Restricted Transactional Memory)
+    @FEATURE: #[stable(feature = "movbe_target_feature", since = "1.67.0")] movbe: "movbe";
+    /// MOVBE (Move Data After Swapping Bytes)
 }
diff --git a/library/stdarch/crates/std_detect/src/detect/os/x86.rs b/library/stdarch/crates/std_detect/src/detect/os/x86.rs
index 08f48cd17a9..46cde892195 100644
--- a/library/stdarch/crates/std_detect/src/detect/os/x86.rs
+++ b/library/stdarch/crates/std_detect/src/detect/os/x86.rs
@@ -111,6 +111,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
         enable(proc_info_ecx, 13, Feature::cmpxchg16b);
         enable(proc_info_ecx, 19, Feature::sse4_1);
         enable(proc_info_ecx, 20, Feature::sse4_2);
+        enable(proc_info_ecx, 22, Feature::movbe);
         enable(proc_info_ecx, 23, Feature::popcnt);
         enable(proc_info_ecx, 25, Feature::aes);
         enable(proc_info_ecx, 29, Feature::f16c);
diff --git a/library/stdarch/crates/std_detect/tests/cpu-detection.rs b/library/stdarch/crates/std_detect/tests/cpu-detection.rs
index 02ad77a633c..b5cabd5040f 100644
--- a/library/stdarch/crates/std_detect/tests/cpu-detection.rs
+++ b/library/stdarch/crates/std_detect/tests/cpu-detection.rs
@@ -152,6 +152,7 @@ fn x86_all() {
     println!("abm: {:?}", is_x86_feature_detected!("abm"));
     println!("lzcnt: {:?}", is_x86_feature_detected!("lzcnt"));
     println!("tbm: {:?}", is_x86_feature_detected!("tbm"));
+    println!("movbe: {:?}", is_x86_feature_detected!("movbe"));
     println!("popcnt: {:?}", is_x86_feature_detected!("popcnt"));
     println!("fxsr: {:?}", is_x86_feature_detected!("fxsr"));
     println!("xsave: {:?}", is_x86_feature_detected!("xsave"));
diff --git a/library/stdarch/crates/std_detect/tests/x86-specific.rs b/library/stdarch/crates/std_detect/tests/x86-specific.rs
index e481620c7cd..a7e9bd6f350 100644
--- a/library/stdarch/crates/std_detect/tests/x86-specific.rs
+++ b/library/stdarch/crates/std_detect/tests/x86-specific.rs
@@ -64,6 +64,7 @@ fn dump() {
     println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b"));
     println!("adx: {:?}", is_x86_feature_detected!("adx"));
     println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
+    println!("movbe: {:?}", is_x86_feature_detected!("movbe"));
 }
 
 #[cfg(feature = "std_detect_env_override")]
@@ -152,4 +153,5 @@ fn compare_with_cupid() {
     );
     assert_eq!(is_x86_feature_detected!("adx"), information.adx(),);
     assert_eq!(is_x86_feature_detected!("rtm"), information.rtm(),);
+    assert_eq!(is_x86_feature_detected!("movbe"), information.movbe(),);
 }