diff --git a/src/serialize/writer/json.rs b/src/serialize/writer/json.rs index 35f429cd..147a4875 100644 --- a/src/serialize/writer/json.rs +++ b/src/serialize/writer/json.rs @@ -565,64 +565,7 @@ where } } -#[cfg(all( - feature = "unstable-simd", - target_arch = "x86_64", - target_feature = "avx2" -))] -#[inline(always)] -fn format_escaped_str(writer: &mut W, value: &str) -> io::Result<()> -where - W: ?Sized + io::Write + WriteExt, -{ - unsafe { - let num_reserved_bytes = value.len() * 8 + 32 + 3; - writer.reserve(num_reserved_bytes); - - let written = crate::serialize::writer::simd::format_escaped_str_impl_256( - writer.as_mut_buffer_ptr(), - value.as_bytes().as_ptr(), - value.len(), - ); - writer.set_written(written); - } - Ok(()) -} - -#[cfg(all( - feature = "unstable-simd", - target_arch = "x86_64", - not(target_feature = "avx2") -))] -#[inline(always)] -fn format_escaped_str(writer: &mut W, value: &str) -> io::Result<()> -where - W: ?Sized + io::Write + WriteExt, -{ - unsafe { - let num_reserved_bytes = value.len() * 8 + 32 + 3; - writer.reserve(num_reserved_bytes); - - if std::is_x86_feature_detected!("avx2") { - let written = crate::serialize::writer::simd::format_escaped_str_impl_256( - writer.as_mut_buffer_ptr(), - value.as_bytes().as_ptr(), - value.len(), - ); - writer.set_written(written); - } else { - let written = crate::serialize::writer::simd::format_escaped_str_impl_128( - writer.as_mut_buffer_ptr(), - value.as_bytes().as_ptr(), - value.len(), - ); - writer.set_written(written); - } - } - Ok(()) -} - -#[cfg(all(feature = "unstable-simd", not(target_arch = "x86_64")))] +#[cfg(feature = "unstable-simd")] #[inline(always)] fn format_escaped_str(writer: &mut W, value: &str) -> io::Result<()> where diff --git a/src/serialize/writer/simd.rs b/src/serialize/writer/simd.rs index 9d0a9e13..3d53ec67 100644 --- a/src/serialize/writer/simd.rs +++ b/src/serialize/writer/simd.rs @@ -118,8 +118,6 @@ macro_rules! impl_format_simd { } #[inline(never)] -#[cfg(not(target_feature = "avx2"))] -#[cfg_attr(target_arch = "x86_64", cold)] pub unsafe fn format_escaped_str_impl_128( odptr: *mut u8, value_ptr: *const u8, @@ -131,19 +129,3 @@ pub unsafe fn format_escaped_str_impl_128( impl_format_simd!(odptr, value_ptr, value_len); } - -#[cfg(target_arch = "x86_64")] -#[inline(never)] -#[cfg_attr(not(target_feature = "avx2"), target_feature(enable = "avx2"))] -#[cfg_attr(not(target_feature = "avx2"), target_feature(enable = "bmi2"))] -pub unsafe fn format_escaped_str_impl_256( - odptr: *mut u8, - value_ptr: *const u8, - value_len: usize, -) -> usize { - const STRIDE: usize = 32; - const STRIDE_SATURATION: u32 = u32::MAX; - type StrVector = std::simd::u8x32; - - impl_format_simd!(odptr, value_ptr, value_len); -}