Skip to content

Commit a7ca029

Browse files
committed
fix(simd): Phase 2 — preserve lowercase aliases under nightly-simd + rustfmt
Codex P1 on PR #173: the nightly-simd dispatch arm shadowed every other re-export branch but dropped the lowercase aliases (`f32x16`, `f64x8`, `u8x64`, etc.) that downstream code and docs reach for. Switching on `--features nightly-simd` was therefore an API break instead of a backend swap. `src/simd_nightly/mod.rs` + 17 lowercase aliases (`f32x16` = `F32x16` etc.) matching the convention already present in `simd_avx2.rs`, `simd_avx512.rs`, and `src/simd_scalar.rs`. Reaches every numeric type the other backends expose under their lowercase names. `src/simd.rs` + Lowercase names added to the nightly dispatch arm's `pub use` list so they reach `crate::simd::*` alongside the PascalCase ones. Also runs rustfmt against the file — the multi-clause `#[cfg(all(...))]` attrs that Phase 2 introduced exceed the column budget and rustfmt prefers the vertical block layout.
1 parent f857a81 commit a7ca029

2 files changed

Lines changed: 58 additions & 5 deletions

File tree

src/simd.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,9 @@ pub const PREFERRED_I16_LANES: usize = 16;
220220
// as soon as `nightly-simd` is on.
221221
#[cfg(feature = "nightly-simd")]
222222
pub use crate::simd_nightly::{
223-
BF16x16, BF16x8, F16x16, F32Mask16, F32Mask8, F32x16, F32x8, F64Mask4, F64Mask8, F64x4, F64x8, I16x16, I16x32,
224-
I32x16, I64x8, I8x32, I8x64, U16x32, U32x16, U32x8, U64x4, U64x8, U8x32, U8x64,
223+
f32x16, f32x8, f64x4, f64x8, i16x16, i16x32, i32x16, i64x8, i8x32, i8x64, u16x32, u32x16, u32x8, u64x4, u64x8,
224+
u8x32, u8x64, BF16x16, BF16x8, F16x16, F32Mask16, F32Mask8, F32x16, F32x8, F64Mask4, F64Mask8, F64x4, F64x8,
225+
I16x16, I16x32, I32x16, I64x8, I8x32, I8x64, U16x32, U32x16, U32x8, U64x4, U64x8, U8x32, U8x64,
225226
};
226227

227228
#[cfg(all(target_arch = "x86_64", target_feature = "avx512f", not(feature = "nightly-simd")))]
@@ -288,10 +289,18 @@ pub use crate::simd_avx512::{BF16x16, BF16x8};
288289
// `RUSTFLAGS="-D warnings"` env, which overrides our v3 config.toml,
289290
// landing on x86-64 baseline → the previous tighter `avx2` predicate
290291
// left no matching arm).
291-
#[cfg(all(target_arch = "x86_64", not(target_feature = "avx512f"), not(feature = "nightly-simd")))]
292+
#[cfg(all(
293+
target_arch = "x86_64",
294+
not(target_feature = "avx512f"),
295+
not(feature = "nightly-simd")
296+
))]
292297
pub use crate::simd_avx512::{f32x8, f64x4, i16x16, i8x32, F32x8, F64x4, I16x16, I8x32};
293298

294-
#[cfg(all(target_arch = "x86_64", not(target_feature = "avx512f"), not(feature = "nightly-simd")))]
299+
#[cfg(all(
300+
target_arch = "x86_64",
301+
not(target_feature = "avx512f"),
302+
not(feature = "nightly-simd")
303+
))]
295304
pub use crate::simd_avx2::{
296305
f32x16, f64x8, i16x32, i32x16, i64x8, i8x64, u32x16, u64x8, u8x64, F32Mask16, F32x16, F64Mask8, F64x8, I16x32,
297306
I32x16, I64x8, I8x64, U16x32, U32x16, U64x8, U8x64,
@@ -1593,7 +1602,11 @@ pub use scalar::{
15931602
};
15941603

15951604
// Other non-x86 targets (wasm, riscv, etc.): full scalar fallback.
1596-
#[cfg(all(not(target_arch = "x86_64"), not(target_arch = "aarch64"), not(feature = "nightly-simd")))]
1605+
#[cfg(all(
1606+
not(target_arch = "x86_64"),
1607+
not(target_arch = "aarch64"),
1608+
not(feature = "nightly-simd")
1609+
))]
15971610
pub use scalar::{
15981611
f32x16, f32x8, f64x4, f64x8, i16x16, i16x32, i32x16, i64x8, i8x32, i8x64, u32x16, u64x8, u8x64, F32Mask16, F32x16,
15991612
F32x8, F64Mask8, F64x4, F64x8, I16x16, I16x32, I32x16, I64x8, I8x32, I8x64, U16x32, U32x16, U64x8, U8x64,

src/simd_nightly/mod.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,43 @@ pub use i_word_types::{I16x16, I16x32, I32x16, I64x8};
4343
pub use masks::{F32Mask16, F32Mask8, F64Mask4, F64Mask8};
4444
pub use u8_types::{U8x32, U8x64};
4545
pub use u_word_types::{U16x32, U32x16, U32x8, U64x4, U64x8};
46+
47+
// Lowercase aliases — match the std::simd convention used by
48+
// `simd_avx2.rs`, `simd_avx512.rs`, and the scalar fallback in
49+
// `simd_scalar.rs`. Consumer docs and downstream code import names like
50+
// `crate::simd::f32x16`; without these aliases, enabling `nightly-simd`
51+
// would silently break those imports (codex P1 on PR #173).
52+
#[allow(non_camel_case_types)]
53+
pub type f32x16 = F32x16;
54+
#[allow(non_camel_case_types)]
55+
pub type f32x8 = F32x8;
56+
#[allow(non_camel_case_types)]
57+
pub type f64x8 = F64x8;
58+
#[allow(non_camel_case_types)]
59+
pub type f64x4 = F64x4;
60+
#[allow(non_camel_case_types)]
61+
pub type u8x64 = U8x64;
62+
#[allow(non_camel_case_types)]
63+
pub type u8x32 = U8x32;
64+
#[allow(non_camel_case_types)]
65+
pub type u16x32 = U16x32;
66+
#[allow(non_camel_case_types)]
67+
pub type u32x16 = U32x16;
68+
#[allow(non_camel_case_types)]
69+
pub type u32x8 = U32x8;
70+
#[allow(non_camel_case_types)]
71+
pub type u64x8 = U64x8;
72+
#[allow(non_camel_case_types)]
73+
pub type u64x4 = U64x4;
74+
#[allow(non_camel_case_types)]
75+
pub type i8x64 = I8x64;
76+
#[allow(non_camel_case_types)]
77+
pub type i8x32 = I8x32;
78+
#[allow(non_camel_case_types)]
79+
pub type i16x32 = I16x32;
80+
#[allow(non_camel_case_types)]
81+
pub type i16x16 = I16x16;
82+
#[allow(non_camel_case_types)]
83+
pub type i32x16 = I32x16;
84+
#[allow(non_camel_case_types)]
85+
pub type i64x8 = I64x8;

0 commit comments

Comments
 (0)