From a27f3e3fd1e4d16160f8885b6b06665b5319f56c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 21 Jul 2025 14:34:12 +0200 Subject: Rename `tests/codegen` into `tests/codegen-llvm` --- tests/codegen-llvm/slice-is-ascii.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/codegen-llvm/slice-is-ascii.rs (limited to 'tests/codegen-llvm/slice-is-ascii.rs') diff --git a/tests/codegen-llvm/slice-is-ascii.rs b/tests/codegen-llvm/slice-is-ascii.rs new file mode 100644 index 00000000000..67537c871a0 --- /dev/null +++ b/tests/codegen-llvm/slice-is-ascii.rs @@ -0,0 +1,16 @@ +//@ only-x86_64 +//@ compile-flags: -C opt-level=3 -C target-cpu=x86-64 +#![crate_type = "lib"] + +/// Check that the fast-path of `is_ascii` uses a `pmovmskb` instruction. +/// Platforms lacking an equivalent instruction use other techniques for +/// optimizing `is_ascii`. +// CHECK-LABEL: @is_ascii_autovectorized +#[no_mangle] +pub fn is_ascii_autovectorized(s: &[u8]) -> bool { + // CHECK: load <32 x i8> + // CHECK-NEXT: icmp slt <32 x i8> + // CHECK-NEXT: bitcast <32 x i1> + // CHECK-NEXT: icmp eq i32 + s.is_ascii() +} -- cgit 1.4.1-3-g733a5