Skip to content

Commit e1e4ba4

Browse files
authored
Tweak doctests to pass in libstd as well (#335)
The boilerplate just gets more and more ugly...
1 parent 40afb02 commit e1e4ba4

File tree

6 files changed

+327
-212
lines changed

6 files changed

+327
-212
lines changed

coresimd/x86/avx2.rs

Lines changed: 99 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,18 +2076,21 @@ pub unsafe fn _mm256_shuffle_epi8(a: __m256i, b: __m256i) -> __m256i {
20762076
/// ```rust
20772077
/// # #![feature(cfg_target_feature)]
20782078
/// # #![feature(target_feature, stdsimd)]
2079-
/// #
2080-
/// # #[macro_use] extern crate stdsimd;
2081-
/// #
2079+
/// # #![cfg_attr(not(dox), no_std)]
2080+
/// # #[cfg(not(dox))]
2081+
/// # extern crate std as real_std;
2082+
/// # #[cfg(not(dox))]
2083+
/// # #[macro_use]
2084+
/// # extern crate stdsimd as std;
2085+
/// #[cfg(target_arch = "x86")]
2086+
/// use std::arch::x86::*;
2087+
/// #[cfg(target_arch = "x86_64")]
2088+
/// use std::arch::x86_64::*;
2089+
///
20822090
/// # fn main() {
20832091
/// # if is_target_feature_detected!("avx2") {
20842092
/// # #[target_feature(enable = "avx2")]
20852093
/// # unsafe fn worker() {
2086-
/// #[cfg(target_arch = "x86")]
2087-
/// use stdsimd::arch::x86::*;
2088-
/// #[cfg(target_arch = "x86_64")]
2089-
/// use stdsimd::arch::x86_64::*;
2090-
///
20912094
/// let a = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
20922095
///
20932096
/// let c1 = _mm256_shuffle_epi32(a, 0b00_11_10_01);
@@ -2682,18 +2685,21 @@ pub unsafe fn _mm256_subs_epu8(a: __m256i, b: __m256i) -> __m256i {
26822685
/// ```rust
26832686
/// # #![feature(cfg_target_feature)]
26842687
/// # #![feature(target_feature, stdsimd)]
2685-
/// #
2686-
/// # #[macro_use] extern crate stdsimd;
2687-
/// #
2688+
/// # #![cfg_attr(not(dox), no_std)]
2689+
/// # #[cfg(not(dox))]
2690+
/// # extern crate std as real_std;
2691+
/// # #[cfg(not(dox))]
2692+
/// # #[macro_use]
2693+
/// # extern crate stdsimd as std;
2694+
/// #[cfg(target_arch = "x86")]
2695+
/// use std::arch::x86::*;
2696+
/// #[cfg(target_arch = "x86_64")]
2697+
/// use std::arch::x86_64::*;
2698+
///
26882699
/// # fn main() {
26892700
/// # if is_target_feature_detected!("avx2") {
26902701
/// # #[target_feature(enable = "avx2")]
26912702
/// # unsafe fn worker() {
2692-
/// #[cfg(target_arch = "x86")]
2693-
/// use stdsimd::arch::x86::*;
2694-
/// #[cfg(target_arch = "x86_64")]
2695-
/// use stdsimd::arch::x86_64::*;
2696-
///
26972703
/// let a = _mm256_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
26982704
/// 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
26992705
/// let b = _mm256_setr_epi8(0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,
@@ -2731,18 +2737,21 @@ pub unsafe fn _mm256_unpackhi_epi8(a: __m256i, b: __m256i) -> __m256i {
27312737
/// ```rust
27322738
/// # #![feature(cfg_target_feature)]
27332739
/// # #![feature(target_feature, stdsimd)]
2734-
/// #
2735-
/// # #[macro_use] extern crate stdsimd;
2736-
/// #
2740+
/// # #![cfg_attr(not(dox), no_std)]
2741+
/// # #[cfg(not(dox))]
2742+
/// # extern crate std as real_std;
2743+
/// # #[cfg(not(dox))]
2744+
/// # #[macro_use]
2745+
/// # extern crate stdsimd as std;
2746+
/// #[cfg(target_arch = "x86")]
2747+
/// use std::arch::x86::*;
2748+
/// #[cfg(target_arch = "x86_64")]
2749+
/// use std::arch::x86_64::*;
2750+
///
27372751
/// # fn main() {
27382752
/// # if is_target_feature_detected!("avx2") {
27392753
/// # #[target_feature(enable = "avx2")]
27402754
/// # unsafe fn worker() {
2741-
/// #[cfg(target_arch = "x86")]
2742-
/// use stdsimd::arch::x86::*;
2743-
/// #[cfg(target_arch = "x86_64")]
2744-
/// use stdsimd::arch::x86_64::*;
2745-
///
27462755
/// let a = _mm256_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
27472756
/// 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
27482757
/// let b = _mm256_setr_epi8(0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,
@@ -2779,18 +2788,21 @@ pub unsafe fn _mm256_unpacklo_epi8(a: __m256i, b: __m256i) -> __m256i {
27792788
/// ```rust
27802789
/// # #![feature(cfg_target_feature)]
27812790
/// # #![feature(target_feature, stdsimd)]
2782-
/// #
2783-
/// # #[macro_use] extern crate stdsimd;
2784-
/// #
2791+
/// # #![cfg_attr(not(dox), no_std)]
2792+
/// # #[cfg(not(dox))]
2793+
/// # extern crate std as real_std;
2794+
/// # #[cfg(not(dox))]
2795+
/// # #[macro_use]
2796+
/// # extern crate stdsimd as std;
2797+
/// #[cfg(target_arch = "x86")]
2798+
/// use std::arch::x86::*;
2799+
/// #[cfg(target_arch = "x86_64")]
2800+
/// use std::arch::x86_64::*;
2801+
///
27852802
/// # fn main() {
27862803
/// # if is_target_feature_detected!("avx2") {
27872804
/// # #[target_feature(enable = "avx2")]
27882805
/// # unsafe fn worker() {
2789-
/// #[cfg(target_arch = "x86")]
2790-
/// use stdsimd::arch::x86::*;
2791-
/// #[cfg(target_arch = "x86_64")]
2792-
/// use stdsimd::arch::x86_64::*;
2793-
///
27942806
/// let a = _mm256_setr_epi16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
27952807
/// let b = _mm256_setr_epi16(0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15);
27962808
///
@@ -2823,17 +2835,21 @@ pub unsafe fn _mm256_unpackhi_epi16(a: __m256i, b: __m256i) -> __m256i {
28232835
/// ```rust
28242836
/// # #![feature(cfg_target_feature)]
28252837
/// # #![feature(target_feature, stdsimd)]
2826-
/// #
2827-
/// # #[macro_use] extern crate stdsimd;
2828-
/// #
2838+
/// # #![cfg_attr(not(dox), no_std)]
2839+
/// # #[cfg(not(dox))]
2840+
/// # extern crate std as real_std;
2841+
/// # #[cfg(not(dox))]
2842+
/// # #[macro_use]
2843+
/// # extern crate stdsimd as std;
2844+
/// #[cfg(target_arch = "x86")]
2845+
/// use std::arch::x86::*;
2846+
/// #[cfg(target_arch = "x86_64")]
2847+
/// use std::arch::x86_64::*;
2848+
///
28292849
/// # fn main() {
28302850
/// # if is_target_feature_detected!("avx2") {
28312851
/// # #[target_feature(enable = "avx2")]
28322852
/// # unsafe fn worker() {
2833-
/// #[cfg(target_arch = "x86")]
2834-
/// use stdsimd::arch::x86::*;
2835-
/// #[cfg(target_arch = "x86_64")]
2836-
/// use stdsimd::arch::x86_64::*;
28372853
///
28382854
/// let a = _mm256_setr_epi16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
28392855
/// let b = _mm256_setr_epi16(0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15);
@@ -2867,18 +2883,21 @@ pub unsafe fn _mm256_unpacklo_epi16(a: __m256i, b: __m256i) -> __m256i {
28672883
/// ```rust
28682884
/// # #![feature(cfg_target_feature)]
28692885
/// # #![feature(target_feature, stdsimd)]
2870-
/// #
2871-
/// # #[macro_use] extern crate stdsimd;
2872-
/// #
2886+
/// # #![cfg_attr(not(dox), no_std)]
2887+
/// # #[cfg(not(dox))]
2888+
/// # extern crate std as real_std;
2889+
/// # #[cfg(not(dox))]
2890+
/// # #[macro_use]
2891+
/// # extern crate stdsimd as std;
2892+
/// #[cfg(target_arch = "x86")]
2893+
/// use std::arch::x86::*;
2894+
/// #[cfg(target_arch = "x86_64")]
2895+
/// use std::arch::x86_64::*;
2896+
///
28732897
/// # fn main() {
28742898
/// # if is_target_feature_detected!("avx2") {
28752899
/// # #[target_feature(enable = "avx2")]
28762900
/// # unsafe fn worker() {
2877-
/// #[cfg(target_arch = "x86")]
2878-
/// use stdsimd::arch::x86::*;
2879-
/// #[cfg(target_arch = "x86_64")]
2880-
/// use stdsimd::arch::x86_64::*;
2881-
///
28822901
/// let a = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
28832902
/// let b = _mm256_setr_epi32(0,-1,-2,-3,-4,-5,-6,-7);
28842903
///
@@ -2910,18 +2929,21 @@ pub unsafe fn _mm256_unpackhi_epi32(a: __m256i, b: __m256i) -> __m256i {
29102929
/// ```rust
29112930
/// # #![feature(cfg_target_feature)]
29122931
/// # #![feature(target_feature, stdsimd)]
2913-
/// #
2914-
/// # #[macro_use] extern crate stdsimd;
2915-
/// #
2932+
/// # #![cfg_attr(not(dox), no_std)]
2933+
/// # #[cfg(not(dox))]
2934+
/// # extern crate std as real_std;
2935+
/// # #[cfg(not(dox))]
2936+
/// # #[macro_use]
2937+
/// # extern crate stdsimd as std;
2938+
/// #[cfg(target_arch = "x86")]
2939+
/// use std::arch::x86::*;
2940+
/// #[cfg(target_arch = "x86_64")]
2941+
/// use std::arch::x86_64::*;
2942+
///
29162943
/// # fn main() {
29172944
/// # if is_target_feature_detected!("avx2") {
29182945
/// # #[target_feature(enable = "avx2")]
29192946
/// # unsafe fn worker() {
2920-
/// #[cfg(target_arch = "x86")]
2921-
/// use stdsimd::arch::x86::*;
2922-
/// #[cfg(target_arch = "x86_64")]
2923-
/// use stdsimd::arch::x86_64::*;
2924-
///
29252947
/// let a = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
29262948
/// let b = _mm256_setr_epi32(0,-1,-2,-3,-4,-5,-6,-7);
29272949
///
@@ -2950,18 +2972,21 @@ pub unsafe fn _mm256_unpacklo_epi32(a: __m256i, b: __m256i) -> __m256i {
29502972
/// ```rust
29512973
/// # #![feature(cfg_target_feature)]
29522974
/// # #![feature(target_feature, stdsimd)]
2953-
/// #
2954-
/// # #[macro_use] extern crate stdsimd;
2955-
/// #
2975+
/// # #![cfg_attr(not(dox), no_std)]
2976+
/// # #[cfg(not(dox))]
2977+
/// # extern crate std as real_std;
2978+
/// # #[cfg(not(dox))]
2979+
/// # #[macro_use]
2980+
/// # extern crate stdsimd as std;
2981+
/// #[cfg(target_arch = "x86")]
2982+
/// use std::arch::x86::*;
2983+
/// #[cfg(target_arch = "x86_64")]
2984+
/// use std::arch::x86_64::*;
2985+
///
29562986
/// # fn main() {
29572987
/// # if is_target_feature_detected!("avx2") {
29582988
/// # #[target_feature(enable = "avx2")]
29592989
/// # unsafe fn worker() {
2960-
/// #[cfg(target_arch = "x86")]
2961-
/// use stdsimd::arch::x86::*;
2962-
/// #[cfg(target_arch = "x86_64")]
2963-
/// use stdsimd::arch::x86_64::*;
2964-
///
29652990
/// let a = _mm256_setr_epi64x(0, 1, 2, 3);
29662991
/// let b = _mm256_setr_epi64x(0,-1,-2,-3);
29672992
///
@@ -2989,18 +3014,21 @@ pub unsafe fn _mm256_unpackhi_epi64(a: __m256i, b: __m256i) -> __m256i {
29893014
/// ```rust
29903015
/// # #![feature(cfg_target_feature)]
29913016
/// # #![feature(target_feature, stdsimd)]
2992-
/// #
2993-
/// # #[macro_use] extern crate stdsimd;
2994-
/// #
3017+
/// # #![cfg_attr(not(dox), no_std)]
3018+
/// # #[cfg(not(dox))]
3019+
/// # extern crate std as real_std;
3020+
/// # #[cfg(not(dox))]
3021+
/// # #[macro_use]
3022+
/// # extern crate stdsimd as std;
3023+
/// #[cfg(target_arch = "x86")]
3024+
/// use std::arch::x86::*;
3025+
/// #[cfg(target_arch = "x86_64")]
3026+
/// use std::arch::x86_64::*;
3027+
///
29953028
/// # fn main() {
29963029
/// # if is_target_feature_detected!("avx2") {
29973030
/// # #[target_feature(enable = "avx2")]
29983031
/// # unsafe fn worker() {
2999-
/// #[cfg(target_arch = "x86")]
3000-
/// use stdsimd::arch::x86::*;
3001-
/// #[cfg(target_arch = "x86_64")]
3002-
/// use stdsimd::arch::x86_64::*;
3003-
///
30043032
/// let a = _mm256_setr_epi64x(0, 1, 2, 3);
30053033
/// let b = _mm256_setr_epi64x(0,-1,-2,-3);
30063034
///

0 commit comments

Comments
 (0)