Skip to content

Commit 4acbe17

Browse files
Licensersunnygleason
authored andcommitted
Use simd-lite (#39)
* Use simd-lite * Update badge * Update badge * Get rid of transmutes * Use NeonInit trait * vqsubq_u8 fix * vqsubq_u8 fix pt. 2 * use reexprted values from simd-lite
1 parent ebf9ca9 commit 4acbe17

13 files changed

Lines changed: 75 additions & 1347 deletions

File tree

.drone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ steps:
6060
commands:
6161
- rustup default nightly
6262
- rustup update
63-
- cargo clean && cargo +nightly build --verbose --all
64-
- cargo +nightly test --verbose --all
63+
- cargo clean && cargo +nightly build --verbose --all --features neon
64+
- cargo +nightly test --verbose --all --features neon

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jemallocator = { version = "0.3", optional = true }
2424
perfcnt = { version = "0.4", optional = true }
2525
getopts = { version = "0.2", optional = true }
2626
colored = { version = "1.7", optional = true }
27+
simd-lite = { git = "https://github.com/simd-lite/simd-lite", optional = true, branch = "reexport" }
2728

2829

2930

@@ -45,6 +46,8 @@ harness = false
4546

4647
[features]
4748
default = ["swar-number-parsing", "serde_impl"]
49+
# Support for ARM NEON SIMD
50+
neon = ["simd-lite"]
4851
# use 8 number at once parsing strategy
4952
swar-number-parsing = []
5053
# serde compatibility

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# SIMD Json for Rust   [![Build Status]][drone.io] [![Windows Build Status]][appveyor.com] [![Latest Version]][crates.io]
22

3-
[Build Status]: https://cloud.drone.io/api/badges/Licenser/simdjson-rs/status.svg
4-
[drone.io]: https://cloud.drone.io/Licenser/simdjson-rs
5-
[Windows Build Status]: https://ci.appveyor.com/api/projects/status/0kf0v6hj5v2gite9?svg=true
3+
4+
[Build Status]: https://cloud.drone.io/api/badges/simd-lite/simdjson-rs/status.svg
5+
[drone.io]: https://cloud.drone.io/simd-lite/simdjson-rs
6+
[Windows Build Status]: https://ci.appveyor.com/api/projects/status/ffi2ese7dxse6pb8?svg=true
67
[appveyor.com]: https://ci.appveyor.com/project/Licenser/simdjson-rs
78
[Latest Version]: https://img.shields.io/crates/v/simd-json.svg
89
[crates.io]: https://crates.io/crates/simd-json

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
stmt_expr_attributes,
1111
simd_ffi,
1212
link_llvm_intrinsics,
13-
rustc_attrs
13+
rustc_attrs,
1414
)
1515
)]
1616

@@ -111,11 +111,11 @@ pub use crate::sse42::deser::*;
111111
#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), not(target_feature = "avx2")))]
112112
use crate::sse42::stage1::SIMDJSON_PADDING;
113113

114-
#[cfg(target_feature = "neon")]
114+
#[cfg(all(target_feature = "neon", feature = "neon"))]
115115
mod neon;
116-
#[cfg(target_feature = "neon")]
116+
#[cfg(all(target_feature = "neon", feature = "neon"))]
117117
pub use crate::neon::deser::*;
118-
#[cfg(target_feature = "neon")]
118+
#[cfg(all(target_feature = "neon", feature = "neon"))]
119119
use crate::neon::stage1::SIMDJSON_PADDING;
120120

121121
mod stage2;

src/neon/deser.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11

2-
pub use crate::error::{Error, ErrorType};
3-
pub use crate::Deserializer;
4-
pub use crate::Result;
5-
pub use crate::neon::stage1::*;
6-
pub use crate::neon::utf8check::*;
7-
pub use crate::neon::intrinsics::*;
8-
pub use crate::stringparse::*;
2+
use crate::error::{ErrorType};
3+
use crate::Deserializer;
4+
use crate::Result;
5+
use crate::stringparse::*;
6+
use simd_lite::aarch64::*;
7+
use crate::neon::stage1::*;
98

109
impl<'de> Deserializer<'de> {
1110
#[cfg_attr(not(feature = "no-inline"), inline(always))]
@@ -196,4 +195,4 @@ impl<'de> Deserializer<'de> {
196195
}
197196
}
198197
}
199-
}
198+
}

src/neon/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::value::generator::ESCAPED;
22
use std::io;
3-
use crate::neon::intrinsics::*;
43
use crate::neon::stage1::neon_movemask;
4+
use simd_lite::aarch64::*;
55

66
#[inline(always)]
77
pub unsafe fn write_str_simd<W>(writer: &mut W, string: &mut &[u8], len: &mut usize, idx: &mut usize) -> io::Result<()> where W: std::io::Write {
@@ -23,7 +23,7 @@ pub unsafe fn write_str_simd<W>(writer: &mut W, string: &mut &[u8], len: &mut us
2323
// then test of the data is unchanged. aka: xor it with the
2424
// Any field that was inside the quote range it will be zero
2525
// now.
26-
let is_unchanged = vxorrq_u8(data, in_quote_range);
26+
let is_unchanged = veorq_u8(data, in_quote_range);
2727
let in_range = vceqq_u8(is_unchanged, zero);
2828
let quote_bits = neon_movemask(vorrq_u8(bs_or_quote, in_range));
2929
if quote_bits != 0 {

0 commit comments

Comments
 (0)