Skip to content

Commit d6ffea0

Browse files
committed
inline assert_instr tests
1 parent 44f4069 commit d6ffea0

2 files changed

Lines changed: 15 additions & 26 deletions

File tree

crates/core_arch/src/aarch64/mte.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,42 +109,46 @@ mod test {
109109
use super::*;
110110
use stdarch_test::assert_instr;
111111

112-
#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(irg))] // FIXME: MSVC `dumpbin` doesn't support MTE
112+
// Instruction tests are separate because the functions use generics.
113+
//
114+
// FIXME: As of 2026 MSVC `dumpbin` doesn't support MTE.
115+
116+
#[cfg_attr(not(target_env = "msvc"), assert_instr(irg))]
113117
#[allow(dead_code)]
114118
#[target_feature(enable = "mte")]
115119
unsafe fn test_arm_mte_create_random_tag(src: *const (), mask: u64) -> *const () {
116120
__arm_mte_create_random_tag(src, mask)
117121
}
118122

119-
#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(addg))]
123+
#[cfg_attr(not(target_env = "msvc"), assert_instr(addg))]
120124
#[allow(dead_code)]
121125
#[target_feature(enable = "mte")]
122126
unsafe fn test_arm_mte_increment_tag(src: *const ()) -> *const () {
123127
__arm_mte_increment_tag::<1, _>(src)
124128
}
125129

126-
#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(gmi))]
130+
#[cfg_attr(not(target_env = "msvc"), assert_instr(gmi))]
127131
#[allow(dead_code)]
128132
#[target_feature(enable = "mte")]
129133
unsafe fn test_arm_mte_exclude_tag(src: *const (), excluded: u64) -> u64 {
130134
__arm_mte_exclude_tag(src, excluded)
131135
}
132136

133-
#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(stg))]
137+
#[cfg_attr(not(target_env = "msvc"), assert_instr(stg))]
134138
#[allow(dead_code)]
135139
#[target_feature(enable = "mte")]
136140
unsafe fn test_arm_mte_set_tag(src: *const ()) {
137141
__arm_mte_set_tag(src)
138142
}
139143

140-
#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(ldg))]
144+
#[cfg_attr(not(target_env = "msvc"), assert_instr(ldg))]
141145
#[allow(dead_code)]
142146
#[target_feature(enable = "mte")]
143147
unsafe fn test_arm_mte_get_tag(src: *const ()) -> *const () {
144148
__arm_mte_get_tag(src)
145149
}
146150

147-
#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(subp))]
151+
#[cfg_attr(not(target_env = "msvc"), assert_instr(subp))]
148152
#[allow(dead_code)]
149153
#[target_feature(enable = "mte")]
150154
unsafe fn test_arm_mte_ptrdiff(a: *const (), b: *const ()) -> i64 {

crates/core_arch/src/aarch64/rand.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
//!
33
//! [ACLE documentation](https://arm-software.github.io/acle/main/acle.html#random-number-generation-intrinsics)
44
5+
#[cfg(test)]
6+
use stdarch_test::assert_instr;
7+
58
unsafe extern "unadjusted" {
69
#[link_name = "llvm.aarch64.rndr"]
710
fn rndr_() -> Tuple;
@@ -22,6 +25,7 @@ struct Tuple {
2225
/// is returned.
2326
#[inline]
2427
#[target_feature(enable = "rand")]
28+
#[cfg_attr(test, assert_instr(mrs))]
2529
#[unstable(feature = "stdarch_aarch64_rand", issue = "153514")]
2630
pub unsafe fn __rndr(value: *mut u64) -> i32 {
2731
let Tuple { bits, status } = rndr_();
@@ -35,29 +39,10 @@ pub unsafe fn __rndr(value: *mut u64) -> i32 {
3539
/// to by the input is set to zero and a non-zero value is returned.
3640
#[inline]
3741
#[target_feature(enable = "rand")]
42+
#[cfg_attr(test, assert_instr(mrs))]
3843
#[unstable(feature = "stdarch_aarch64_rand", issue = "153514")]
3944
pub unsafe fn __rndrrs(value: *mut u64) -> i32 {
4045
let Tuple { bits, status } = rndrrs_();
4146
unsafe { *value = bits };
4247
status as i32
4348
}
44-
45-
#[cfg(test)]
46-
mod test {
47-
use super::*;
48-
use stdarch_test::assert_instr;
49-
50-
#[cfg_attr(test, assert_instr(mrs))]
51-
#[allow(dead_code)]
52-
#[target_feature(enable = "rand")]
53-
unsafe fn test_rndr(value: &mut u64) -> i32 {
54-
__rndr(value)
55-
}
56-
57-
#[cfg_attr(test, assert_instr(mrs))]
58-
#[allow(dead_code)]
59-
#[target_feature(enable = "rand")]
60-
unsafe fn test_rndrrs(value: &mut u64) -> i32 {
61-
__rndrrs(value)
62-
}
63-
}

0 commit comments

Comments
 (0)