mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Mark is_ascii_sse2 as #[inline]
This commit is contained in:
@@ -465,6 +465,7 @@ const fn contains_nonascii(v: usize) -> bool {
|
||||
const SSE2_CHUNK_SIZE: usize = 64;
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
|
||||
#[inline]
|
||||
fn is_ascii_sse2(bytes: &[u8]) -> bool {
|
||||
use crate::arch::x86_64::{__m128i, _mm_loadu_si128, _mm_movemask_epi8, _mm_or_si128};
|
||||
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
//@ revisions: LA64
|
||||
//@ revisions: X86_64 LA64
|
||||
//@ assembly-output: emit-asm
|
||||
//@ compile-flags: -C opt-level=3
|
||||
//
|
||||
//@ [X86_64] only-x86_64
|
||||
//@ [X86_64] compile-flags: -C target-cpu=znver4
|
||||
//@ [X86_64] compile-flags: -C llvm-args=-x86-asm-syntax=intel
|
||||
//
|
||||
//@ [LA64] only-loongarch64
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
/// Verify `is_ascii` generates efficient code on different architectures:
|
||||
///
|
||||
/// - x86_64: Must NOT use `kshiftrd`/`kshiftrq` (broken AVX-512 auto-vectorization).
|
||||
/// Good version uses explicit SSE2 intrinsics (`pmovmskb`/`vpmovmskb`).
|
||||
///
|
||||
/// - loongarch64: Should use `vmskltz.b` instruction for the fast-path.
|
||||
|
||||
// X86_64-LABEL: test_is_ascii
|
||||
// X86_64-NOT: kshiftrd
|
||||
// X86_64-NOT: kshiftrq
|
||||
// X86_64: {{vpor|por}}
|
||||
// X86_64: {{vpmovmskb|pmovmskb}}
|
||||
|
||||
// LA64-LABEL: test_is_ascii
|
||||
// LA64: vmskltz.b
|
||||
|
||||
|
||||
Reference in New Issue
Block a user