Skip to content

Commit c9c1878

Browse files
committed
Attempt to fix tests on master
* Make all doctests use items from the real `std` rather than this crate, it's just easier * Handle debuginfo weirdness by flagging functions as `no_mangle` that we're looking for instructions within.
1 parent 77a38ba commit c9c1878

File tree

4 files changed

+3
-74
lines changed

4 files changed

+3
-74
lines changed

crates/assert-instr-macro/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn assert_instr(
4949
.replace(':', "_")
5050
.replace(|c: char| c.is_whitespace(), "");
5151
let assert_name = syn::Ident::new(&format!("assert_{}_{}", name, instr_str), name.span());
52-
let shim_name = syn::Ident::new(&format!("{}_shim", name), name.span());
52+
let shim_name = syn::Ident::new(&format!("{}_shim_{}", name, assert_name), name.span());
5353
let mut inputs = Vec::new();
5454
let mut input_vals = Vec::new();
5555
let ret = &func.decl.output;
@@ -99,6 +99,7 @@ pub fn assert_instr(
9999
let shim_name_str = format!("{}{}", shim_name, assert_name);
100100
let to_test = quote! {
101101
#attrs
102+
#[no_mangle]
102103
unsafe extern #abi fn #shim_name(#(#inputs),*) #ret {
103104
// The compiler in optimized mode by default runs a pass called
104105
// "mergefunc" where it'll merge functions that look identical.

crates/core_arch/src/core_arch_docs.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,6 @@ Next up let's take a look at an example of manually using intrinsics. Here
251251
we'll be using SSE4.1 features to implement hex encoding.
252252

253253
```
254-
# #![cfg_attr(not(dox),feature(stdsimd))]
255-
# #![cfg_attr(not(dox), no_std)]
256-
# #[cfg(not(dox))]
257-
# extern crate std as real_std;
258-
# #[cfg(not(dox))]
259-
# extern crate core_arch as std;
260-
# #[cfg(not(dox))]
261-
# #[macro_use(is_x86_feature_detected)]
262-
# extern crate std_detect;
263-
264254
fn main() {
265255
let mut dst = [0; 32];
266256
hex_encode(b"\x01\x02\x03", &mut dst);

crates/core_arch/src/x86/mod.rs

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ types! {
3434
///
3535
/// ```
3636
/// # #![feature(stdsimd, mmx_target_feature)]
37-
/// # #![cfg_attr(not(dox), no_std)]
38-
/// # #[cfg(not(dox))]
39-
/// # extern crate std as real_std;
40-
/// # #[cfg(not(dox))]
41-
/// # extern crate core_arch as std;
42-
/// # #[cfg(not(dox))]
43-
/// # #[macro_use(is_x86_feature_detected)]
44-
/// # extern crate std_detect;
4537
/// #[cfg(target_arch = "x86")]
4638
/// use std::arch::x86::*;
4739
/// #[cfg(target_arch = "x86_64")]
@@ -85,15 +77,6 @@ types! {
8577
/// # Examples
8678
///
8779
/// ```
88-
/// # #![cfg_attr(not(dox), feature(stdsimd))]
89-
/// # #![cfg_attr(not(dox), no_std)]
90-
/// # #[cfg(not(dox))]
91-
/// # extern crate std as real_std;
92-
/// # #[cfg(not(dox))]
93-
/// # extern crate core_arch as std;
94-
/// # #[cfg(not(dox))]
95-
/// # #[macro_use(is_x86_feature_detected)]
96-
/// # extern crate std_detect;
9780
/// #[cfg(target_arch = "x86")]
9881
/// use std::arch::x86::*;
9982
/// #[cfg(target_arch = "x86_64")]
@@ -131,15 +114,6 @@ types! {
131114
/// # Examples
132115
///
133116
/// ```
134-
/// # #![cfg_attr(not(dox), feature(stdsimd))]
135-
/// # #![cfg_attr(not(dox), no_std)]
136-
/// # #[cfg(not(dox))]
137-
/// # extern crate std as real_std;
138-
/// # #[cfg(not(dox))]
139-
/// # extern crate core_arch as std;
140-
/// # #[cfg(not(dox))]
141-
/// # #[macro_use(is_x86_feature_detected)]
142-
/// # extern crate std_detect;
143117
/// #[cfg(target_arch = "x86")]
144118
/// use std::arch::x86::*;
145119
/// #[cfg(target_arch = "x86_64")]
@@ -177,15 +151,6 @@ types! {
177151
/// # Examples
178152
///
179153
/// ```
180-
/// # #![cfg_attr(not(dox), feature(stdsimd))]
181-
/// # #![cfg_attr(not(dox), no_std)]
182-
/// # #[cfg(not(dox))]
183-
/// # extern crate std as real_std;
184-
/// # #[cfg(not(dox))]
185-
/// # extern crate core_arch as std;
186-
/// # #[cfg(not(dox))]
187-
/// # #[macro_use(is_x86_feature_detected)]
188-
/// # extern crate std_detect;
189154
/// #[cfg(target_arch = "x86")]
190155
/// use std::arch::x86::*;
191156
/// #[cfg(target_arch = "x86_64")]
@@ -227,15 +192,6 @@ types! {
227192
/// # Examples
228193
///
229194
/// ```
230-
/// # #![cfg_attr(not(dox), feature(stdsimd))]
231-
/// # #![cfg_attr(not(dox), no_std)]
232-
/// # #[cfg(not(dox))]
233-
/// # extern crate std as real_std;
234-
/// # #[cfg(not(dox))]
235-
/// # extern crate core_arch as std;
236-
/// # #[cfg(not(dox))]
237-
/// # #[macro_use(is_x86_feature_detected)]
238-
/// # extern crate std_detect;
239195
/// #[cfg(target_arch = "x86")]
240196
/// use std::arch::x86::*;
241197
/// #[cfg(target_arch = "x86_64")]
@@ -273,15 +229,6 @@ types! {
273229
/// # Examples
274230
///
275231
/// ```
276-
/// # #![cfg_attr(not(dox), feature(stdsimd))]
277-
/// # #![cfg_attr(not(dox), no_std)]
278-
/// # #[cfg(not(dox))]
279-
/// # extern crate std as real_std;
280-
/// # #[cfg(not(dox))]
281-
/// # extern crate core_arch as std;
282-
/// # #[cfg(not(dox))]
283-
/// # #[macro_use(is_x86_feature_detected)]
284-
/// # extern crate std_detect;
285232
/// #[cfg(target_arch = "x86")]
286233
/// use std::arch::x86::*;
287234
/// #[cfg(target_arch = "x86_64")]
@@ -319,15 +266,6 @@ types! {
319266
/// # Examples
320267
///
321268
/// ```
322-
/// # #![cfg_attr(not(dox), feature(stdsimd))]
323-
/// # #![cfg_attr(not(dox), no_std)]
324-
/// # #[cfg(not(dox))]
325-
/// # extern crate std as real_std;
326-
/// # #[cfg(not(dox))]
327-
/// # extern crate core_arch as std;
328-
/// # #[cfg(not(dox))]
329-
/// # #[macro_use(is_x86_feature_detected)]
330-
/// # extern crate std_detect;
331269
/// #[cfg(target_arch = "x86")]
332270
/// use std::arch::x86::*;
333271
/// #[cfg(target_arch = "x86_64")]

crates/core_arch/src/x86_64/bmi2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use stdsimd_test::assert_instr;
2020
///
2121
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mulx_u64)
2222
#[inline]
23-
#[cfg_attr(test, assert_instr(mulx))]
23+
#[cfg_attr(test, assert_instr(mul))]
2424
#[target_feature(enable = "bmi2")]
2525
#[cfg(not(target_arch = "x86"))] // calls an intrinsic
2626
#[stable(feature = "simd_x86", since = "1.27.0")]

0 commit comments

Comments
 (0)