-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Put something in the readme so we can have a PR * Add drone file * update build status * unguard for sse4.2 to allow rust to polyfill on older platforms * Add more simd tests * RFC: Neon support (pretty much working) (#35) * feat: neon support * feat: temp stub replacements for neon intrinsics (pending rust-lang/stdarch#792) * fix: drone CI rustup nightly * feat: fix guards, use rust stdlib for bit count operations * fix: remove double semicolon * feat: fancy generic generator functions, thanks @Licenser * Update extq intrinsics * 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 * add simd-lite real version
- Loading branch information
1 parent
84eee6d
commit 1954f9b
Showing
26 changed files
with
1,399 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
kind: pipeline | ||
name: test-on-avx2 | ||
|
||
platform: | ||
arch: amd64 | ||
|
||
steps: | ||
- name: test | ||
image: rust:1 | ||
environment: | ||
RUSTFLAGS: '-C target-cpu=native' | ||
commands: | ||
- cargo build --verbose --all | ||
- cargo test --verbose --all | ||
--- | ||
|
||
kind: pipeline | ||
name: test-on-sse42 | ||
|
||
platform: | ||
arch: amd64 | ||
|
||
steps: | ||
- name: test | ||
image: rust:1 | ||
environment: | ||
RUSTFLAGS: '-C target-cpu=native -C target-feature=-avx2' | ||
commands: | ||
- cargo build --verbose --all | ||
- cargo test --verbose --all | ||
|
||
--- | ||
|
||
kind: pipeline | ||
name: test-on-pre-sse42 | ||
|
||
platform: | ||
arch: amd64 | ||
|
||
steps: | ||
- name: test | ||
image: rust:1 | ||
environment: | ||
RUSTFLAGS: '-C target-cpu=native -C target-feature=-avx2,-sse4.2' | ||
commands: | ||
- cargo build --verbose --all | ||
- cargo test --verbose --all | ||
|
||
--- | ||
|
||
kind: pipeline | ||
name: test-on-arm64 | ||
|
||
platform: | ||
arch: arm64 | ||
|
||
steps: | ||
- name: test | ||
image: rust:1 | ||
commands: | ||
- rustup default nightly | ||
- rustup update | ||
- cargo clean && cargo +nightly build --verbose --all --features neon | ||
- cargo +nightly test --verbose --all --features neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["string contains bad UTF-8 €"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["contains bad UTF-8 �"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["contains bad UTF-8 �"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["bad UTF-8 �"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["UTF-8 �"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[" �"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["�"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#[cfg(target_arch = "x86")] | ||
use std::arch::x86::*; | ||
#[cfg(target_arch = "x86_64")] | ||
use std::arch::x86_64::*; | ||
|
||
use crate::value::generator::ESCAPED; | ||
use std::io; | ||
|
||
#[inline(always)] | ||
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 { | ||
let zero = _mm256_set1_epi8(0); | ||
let lower_quote_range = _mm256_set1_epi8(0x1F as i8); | ||
let quote = _mm256_set1_epi8(b'"' as i8); | ||
let backslash = _mm256_set1_epi8(b'\\' as i8); | ||
while *len - *idx >= 32 { | ||
// Load 32 bytes of data; | ||
#[allow(clippy::cast_ptr_alignment)] | ||
let data: __m256i = _mm256_loadu_si256(string.as_ptr().add(*idx) as *const __m256i); | ||
// Test the data against being backslash and quote. | ||
let bs_or_quote = _mm256_or_si256( | ||
_mm256_cmpeq_epi8(data, backslash), | ||
_mm256_cmpeq_epi8(data, quote), | ||
); | ||
// Now mask the data with the quote range (0x1F). | ||
let in_quote_range = _mm256_and_si256(data, lower_quote_range); | ||
// then test of the data is unchanged. aka: xor it with the | ||
// Any field that was inside the quote range it will be zero | ||
// now. | ||
let is_unchanged = _mm256_xor_si256(data, in_quote_range); | ||
let in_range = _mm256_cmpeq_epi8(is_unchanged, zero); | ||
let quote_bits = _mm256_movemask_epi8(_mm256_or_si256(bs_or_quote, in_range)); | ||
if quote_bits != 0 { | ||
let quote_dist = quote_bits.trailing_zeros() as usize; | ||
stry!(writer.write_all(&string[0..*idx + quote_dist])); | ||
let ch = string[*idx + quote_dist]; | ||
match ESCAPED[ch as usize] { | ||
b'u' => stry!(write!(writer, "\\u{:04x}", ch)), | ||
|
||
escape => stry!(writer.write_all(&[b'\\', escape])), | ||
}; | ||
*string = &string[*idx + quote_dist + 1..]; | ||
*idx = 0; | ||
*len = string.len(); | ||
} else { | ||
*idx += 32; | ||
} | ||
} | ||
stry!(writer.write_all(&string[0..*idx])); | ||
*string = &string[*idx..]; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod deser; | ||
pub mod stage1; | ||
pub mod utf8check; | ||
pub mod utf8check; | ||
pub mod generator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.