Skip to content

Commit

Permalink
impl_format_simd!() lift create from loop, rotate left
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Feb 14, 2024
1 parent 528220f commit a2f7b7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ jobs:
{
arch: 's390x',
cflags: '-O2 -flto -march=z10',
features: 'no-panic,unstable-simd,yyjson',
# no unstable-simd as rotate_elements_left() causes exit 125 in at least QEMU
features: 'no-panic,yyjson',
rustflags: '-Z mir-opt-level=4 -C target-cpu=z10 -D warnings',
target: 's390x-unknown-linux-gnu',
},
Expand Down
20 changes: 13 additions & 7 deletions src/serialize/writer/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ macro_rules! impl_format_simd {
}
}

let mut v = if unlikely!(is_cross_page!(sptr)) {
let mut v = StrVector::default();
v.as_mut_array()[..nb].copy_from_slice(core::slice::from_raw_parts(sptr, nb));
v
} else {
StrVector::from_slice(core::slice::from_raw_parts(sptr, STRIDE))
};
while nb > 0 {
let v = if unlikely!(is_cross_page!(sptr)) {
let mut v = StrVector::default();
v.as_mut_array()[..nb].copy_from_slice(core::slice::from_raw_parts(sptr, nb));
v
} else {
StrVector::from_slice(core::slice::from_raw_parts(sptr, STRIDE))
};
v.copy_to_slice(core::slice::from_raw_parts_mut(dptr, STRIDE));
let mut mask = (v.simd_eq(blash) | v.simd_eq(quote) | v.simd_lt(x20)).to_bitmask()
as u32
Expand All @@ -82,7 +82,13 @@ macro_rules! impl_format_simd {
break;
} else {
let cn = mask.trailing_zeros() as usize;
let nb_start = nb;
impl_escape_unchecked!(sptr, dptr, nb, mask, cn);
let mut consumed = nb_start - nb;
while consumed != 0 {
v = v.rotate_elements_left::<1>();
consumed -= 1;
}
}
}

Expand Down

0 comments on commit a2f7b7b

Please sign in to comment.