Skip to content

Commit f1bfb4d

Browse files
committed
Reorganize and refactor source tree
With RFC 2325 looking close to being accepted, I took a crack at reorganizing this repository to being more amenable for inclusion in libstd/libcore. My current plan is to add stdsimd as a submodule in rust-lang/rust and then use `#[path]` to include the modules directly into libstd/libcore. Before this commit, however, the source code of coresimd/stdsimd themselves were not quite ready for this. Imports wouldn't compile for one reason or another, and the organization was also different than the RFC itself! In addition to moving a lot of files around, this commit has the following major changes: * The `cfg_feature_enabled!` macro is now renamed to `is_target_feature_detected!` * The `vendor` module is now called `arch`. * Under the `arch` module is a suite of modules like `x86`, `x86_64`, etc. One per `cfg!(target_arch)`. * The `is_target_feature_detected!` macro was removed from coresimd. Unfortunately libcore has no ability to export unstable macros, so for now all feature detection is canonicalized in stdsimd. The `coresimd` and `stdsimd` crates have been updated to the planned organization in RFC 2325 as well. The runtime bits saw the largest amount of refactoring, seeing a good deal of simplification without the core/std split.
1 parent b01b28f commit f1bfb4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1828
-2037
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ matrix:
2424
- env: DOCUMENTATION
2525
install: true
2626
script: ci/dox.sh
27-
- script: cargo test --manifest-path stdsimd-verify/Cargo.toml
27+
- script: cargo test --manifest-path crates/stdsimd-verify/Cargo.toml
2828
install: true
2929
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
3030
script: |

Cargo.toml

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
1-
[package]
2-
name = "stdsimd"
3-
version = "0.0.3"
4-
authors = ["Andrew Gallant <[email protected]>"]
5-
description = "SIMD support in Rust's standard library."
6-
documentation = "https://docs.rs/stdsimd"
7-
homepage = "https://github.com/rust-lang-nursery/stdsimd"
8-
repository = "https://github.com/rust-lang-nursery/stdsimd"
9-
readme = "README.md"
10-
keywords = ["std", "simd", "intrinsics"]
11-
categories = ["hardware-support"]
12-
license = "MIT/Apache-2.0"
13-
141
[workspace]
15-
members = ["stdsimd-verify"]
16-
17-
[badges]
18-
travis-ci = { repository = "rust-lang-nursery/stdsimd" }
19-
appveyor = { repository = "rust-lang-nursery/stdsimd" }
20-
is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/stdsimd" }
21-
is-it-maintained-open-issues = { repository = "rust-lang-nursery/stdsimd" }
22-
maintenance = { status = "experimental" }
23-
24-
[dependencies]
25-
coresimd = { version = "0.0.3", path = "coresimd/" }
26-
27-
[dev-dependencies]
28-
auxv = "0.3.3"
29-
quickcheck = "0.6"
30-
rand = "0.4"
2+
members = [
3+
"crates/stdsimd-verify",
4+
"crates/stdsimd",
5+
]
316

327
[profile.release]
338
debug = true
@@ -36,10 +11,3 @@ opt-level = 3
3611
[profile.bench]
3712
debug = 1
3813
opt-level = 3
39-
40-
[features]
41-
# Internal-usage only: denies all warnings.
42-
strict = [ "coresimd/strict" ]
43-
# Internal-usage only: enables only those intrinsics supported by Intel's
44-
# Software Development Environment (SDE).
45-
intel_sde = [ "coresimd/intel_sde" ]

coresimd/LICENSE-APACHE

Lines changed: 0 additions & 1 deletion
This file was deleted.

coresimd/LICENSE-MIT

Lines changed: 0 additions & 1 deletion
This file was deleted.

coresimd/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

coresimd/src/aarch64/neon.rs renamed to coresimd/aarch64/neon.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#[cfg(test)]
66
use stdsimd_test::assert_instr;
7-
use simd_llvm::simd_add;
8-
use v128::f64x2;
7+
use coresimd::simd_llvm::simd_add;
8+
use coresimd::v128::f64x2;
99

1010
/// Vector add.
1111
#[inline]
@@ -41,8 +41,8 @@ pub unsafe fn vaddd_u64(a: u64, b: u64) -> u64 {
4141

4242
#[cfg(test)]
4343
mod tests {
44-
use super::f64x2;
45-
use aarch64::neon;
44+
use simd::f64x2;
45+
use coresimd::aarch64::neon;
4646
use stdsimd_test::simd_test;
4747

4848
#[simd_test = "neon"]

coresimd/src/aarch64/v8.rs renamed to coresimd/aarch64/v8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub unsafe fn _cls_u64(x: u64) -> u64 {
5757

5858
#[cfg(test)]
5959
mod tests {
60-
use aarch64::v8;
60+
use coresimd::aarch64::v8;
6161

6262
#[test]
6363
fn _rev_u64() {
File renamed without changes.

coresimd/src/arm/neon.rs renamed to coresimd/arm/neon.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#[cfg(test)]
44
use stdsimd_test::assert_instr;
55

6-
use simd_llvm::simd_add;
7-
8-
use v64::{f32x2, i16x4, i32x2, i8x8, u16x4, u32x2, u8x8};
9-
use v128::{f32x4, i16x8, i32x4, i64x2, i8x16, u16x8, u32x4, u64x2, u8x16};
6+
use coresimd::simd_llvm::simd_add;
7+
use coresimd::v64::*;
8+
use coresimd::v128::*;
109

1110
/// Vector add.
1211
#[inline]
@@ -216,7 +215,7 @@ pub unsafe fn vrsqrte_f32(a: f32x2) -> f32x2 {
216215
mod tests {
217216
use stdsimd_test::simd_test;
218217
use simd::*;
219-
use arm::neon;
218+
use coresimd::arm::neon;
220219

221220
#[simd_test = "neon"]
222221
unsafe fn vadd_s8() {

coresimd/src/arm/v6.rs renamed to coresimd/arm/v6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub unsafe fn _rev_u32(x: u32) -> u32 {
2525

2626
#[cfg(test)]
2727
mod tests {
28-
use arm::v6;
28+
use coresimd::arm::v6;
2929

3030
#[test]
3131
fn _rev_u16() {

coresimd/src/arm/v7.rs renamed to coresimd/arm/v7.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern "C" {
5050

5151
#[cfg(test)]
5252
mod tests {
53-
use arm::v7;
53+
use coresimd::arm::v7;
5454

5555
#[test]
5656
fn _clz_u8() {

coresimd/src/macros.rs renamed to coresimd/macros.rs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ macro_rules! define_impl {
8282
slice: &mut [$elemty],
8383
offset: usize,
8484
) {
85-
use core::mem::size_of;
86-
use core::ptr;
85+
use mem::size_of;
86+
use ptr;
8787

8888
ptr::copy_nonoverlapping(
8989
&self as *const $name as *const u8,
@@ -102,8 +102,8 @@ macro_rules! define_impl {
102102
slice: &[$elemty],
103103
offset: usize,
104104
) -> $name {
105-
use core::mem::size_of;
106-
use core::ptr;
105+
use mem::size_of;
106+
use ptr;
107107

108108
let mut x = $name::splat(0 as $elemty);
109109
ptr::copy_nonoverlapping(
@@ -152,7 +152,7 @@ macro_rules! define_from {
152152
impl From<$from> for $to {
153153
#[inline(always)]
154154
fn from(f: $from) -> $to {
155-
unsafe { ::core::mem::transmute(f) }
155+
unsafe { ::mem::transmute(f) }
156156
}
157157
}
158158
)+
@@ -162,75 +162,75 @@ macro_rules! define_from {
162162
macro_rules! define_common_ops {
163163
($($ty:ident),+) => {
164164
$(
165-
impl ::core::ops::Add for $ty {
165+
impl ::ops::Add for $ty {
166166
type Output = Self;
167167
#[inline(always)]
168168
fn add(self, other: Self) -> Self {
169169
unsafe { simd_add(self, other) }
170170
}
171171
}
172172

173-
impl ::core::ops::Sub for $ty {
173+
impl ::ops::Sub for $ty {
174174
type Output = Self;
175175
#[inline(always)]
176176
fn sub(self, other: Self) -> Self {
177177
unsafe { simd_sub(self, other) }
178178
}
179179
}
180180

181-
impl ::core::ops::Mul for $ty {
181+
impl ::ops::Mul for $ty {
182182
type Output = Self;
183183
#[inline(always)]
184184
fn mul(self, other: Self) -> Self {
185185
unsafe { simd_mul(self, other) }
186186
}
187187
}
188188

189-
impl ::core::ops::Div for $ty {
189+
impl ::ops::Div for $ty {
190190
type Output = Self;
191191
#[inline(always)]
192192
fn div(self, other: Self) -> Self {
193193
unsafe { simd_div(self, other) }
194194
}
195195
}
196196

197-
impl ::core::ops::Rem for $ty {
197+
impl ::ops::Rem for $ty {
198198
type Output = Self;
199199
#[inline(always)]
200200
fn rem(self, other: Self) -> Self {
201201
unsafe { simd_rem(self, other) }
202202
}
203203
}
204204

205-
impl ::core::ops::AddAssign for $ty {
205+
impl ::ops::AddAssign for $ty {
206206
#[inline(always)]
207207
fn add_assign(&mut self, other: Self) {
208208
*self = *self + other;
209209
}
210210
}
211211

212-
impl ::core::ops::SubAssign for $ty {
212+
impl ::ops::SubAssign for $ty {
213213
#[inline(always)]
214214
fn sub_assign(&mut self, other: Self) {
215215
*self = *self - other;
216216
}
217217
}
218218

219-
impl ::core::ops::MulAssign for $ty {
219+
impl ::ops::MulAssign for $ty {
220220
#[inline(always)]
221221
fn mul_assign(&mut self, other: Self) {
222222
*self = *self * other;
223223
}
224224
}
225225

226-
impl ::core::ops::DivAssign for $ty {
226+
impl ::ops::DivAssign for $ty {
227227
#[inline(always)]
228228
fn div_assign(&mut self, other: Self) {
229229
*self = *self / other;
230230
}
231231
}
232232

233-
impl ::core::ops::RemAssign for $ty {
233+
impl ::ops::RemAssign for $ty {
234234
#[inline(always)]
235235
fn rem_assign(&mut self, other: Self) {
236236
*self = *self % other;
@@ -244,28 +244,28 @@ macro_rules! define_common_ops {
244244
macro_rules! define_shifts {
245245
($ty:ident, $elem:ident, $($by:ident),+) => {
246246
$(
247-
impl ::core::ops::Shl<$by> for $ty {
247+
impl ::ops::Shl<$by> for $ty {
248248
type Output = Self;
249249
#[inline(always)]
250250
fn shl(self, other: $by) -> Self {
251251
unsafe { simd_shl(self, $ty::splat(other as $elem)) }
252252
}
253253
}
254-
impl ::core::ops::Shr<$by> for $ty {
254+
impl ::ops::Shr<$by> for $ty {
255255
type Output = Self;
256256
#[inline(always)]
257257
fn shr(self, other: $by) -> Self {
258258
unsafe { simd_shr(self, $ty::splat(other as $elem)) }
259259
}
260260
}
261261

262-
impl ::core::ops::ShlAssign<$by> for $ty {
262+
impl ::ops::ShlAssign<$by> for $ty {
263263
#[inline(always)]
264264
fn shl_assign(&mut self, other: $by) {
265265
*self = *self << other;
266266
}
267267
}
268-
impl ::core::ops::ShrAssign<$by> for $ty {
268+
impl ::ops::ShrAssign<$by> for $ty {
269269
#[inline(always)]
270270
fn shr_assign(&mut self, other: $by) {
271271
*self = *self >> other;
@@ -279,7 +279,7 @@ macro_rules! define_shifts {
279279
macro_rules! define_float_ops {
280280
($($ty:ident),+) => {
281281
$(
282-
impl ::core::ops::Neg for $ty {
282+
impl ::ops::Neg for $ty {
283283
type Output = Self;
284284
#[inline(always)]
285285
fn neg(self) -> Self {
@@ -293,7 +293,7 @@ macro_rules! define_float_ops {
293293
macro_rules! define_signed_integer_ops {
294294
($($ty:ident),+) => {
295295
$(
296-
impl ::core::ops::Neg for $ty {
296+
impl ::ops::Neg for $ty {
297297
type Output = Self;
298298
#[inline(always)]
299299
fn neg(self) -> Self {
@@ -307,48 +307,48 @@ macro_rules! define_signed_integer_ops {
307307
macro_rules! define_integer_ops {
308308
($(($ty:ident, $elem:ident)),+) => {
309309
$(
310-
impl ::core::ops::Not for $ty {
310+
impl ::ops::Not for $ty {
311311
type Output = Self;
312312
#[inline(always)]
313313
fn not(self) -> Self {
314314
$ty::splat(!0) ^ self
315315
}
316316
}
317317

318-
impl ::core::ops::BitAnd for $ty {
318+
impl ::ops::BitAnd for $ty {
319319
type Output = Self;
320320
#[inline(always)]
321321
fn bitand(self, other: Self) -> Self {
322322
unsafe { simd_and(self, other) }
323323
}
324324
}
325-
impl ::core::ops::BitOr for $ty {
325+
impl ::ops::BitOr for $ty {
326326
type Output = Self;
327327
#[inline(always)]
328328
fn bitor(self, other: Self) -> Self {
329329
unsafe { simd_or(self, other) }
330330
}
331331
}
332-
impl ::core::ops::BitXor for $ty {
332+
impl ::ops::BitXor for $ty {
333333
type Output = Self;
334334
#[inline(always)]
335335
fn bitxor(self, other: Self) -> Self {
336336
unsafe { simd_xor(self, other) }
337337
}
338338
}
339-
impl ::core::ops::BitAndAssign for $ty {
339+
impl ::ops::BitAndAssign for $ty {
340340
#[inline(always)]
341341
fn bitand_assign(&mut self, other: Self) {
342342
*self = *self & other;
343343
}
344344
}
345-
impl ::core::ops::BitOrAssign for $ty {
345+
impl ::ops::BitOrAssign for $ty {
346346
#[inline(always)]
347347
fn bitor_assign(&mut self, other: Self) {
348348
*self = *self | other;
349349
}
350350
}
351-
impl ::core::ops::BitXorAssign for $ty {
351+
impl ::ops::BitXorAssign for $ty {
352352
#[inline(always)]
353353
fn bitxor_assign(&mut self, other: Self) {
354354
*self = *self ^ other;
@@ -360,12 +360,12 @@ macro_rules! define_integer_ops {
360360
u8, u16, u32, u64, usize,
361361
i8, i16, i32, i64, isize);
362362

363-
impl ::core::fmt::LowerHex for $ty {
364-
fn fmt(&self, f: &mut ::core::fmt::Formatter)
365-
-> ::core::fmt::Result {
363+
impl ::fmt::LowerHex for $ty {
364+
fn fmt(&self, f: &mut ::fmt::Formatter)
365+
-> ::fmt::Result {
366366
write!(f, "{}(", stringify!($ty))?;
367-
let n = ::core::mem::size_of_val(self)
368-
/ ::core::mem::size_of::<$elem>();
367+
let n = ::mem::size_of_val(self)
368+
/ ::mem::size_of::<$elem>();
369369
for i in 0..n {
370370
if i > 0 {
371371
write!(f, ", ")?;
@@ -384,7 +384,7 @@ macro_rules! define_casts {
384384
$(
385385
impl $fromty {
386386
#[inline(always)]
387-
pub fn $cast(self) -> ::simd::$toty {
387+
pub fn $cast(self) -> ::coresimd::simd::$toty {
388388
unsafe { simd_cast(self) }
389389
}
390390
}

0 commit comments

Comments
 (0)