-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Labels
C-bugCategory: BugCategory: Bug
Description
I tried this code (godbolt):
#![feature(portable_simd)]
use std::simd::prelude::*;
type Simd = u8x16;
#[no_mangle]
pub fn check_hex(chunk: Simd) -> bool {
let valid_digit = chunk.simd_ge(Simd::splat(b'0')) & chunk.simd_le(Simd::splat(b'9'));
let valid_upper = chunk.simd_ge(Simd::splat(b'A')) & chunk.simd_le(Simd::splat(b'F'));
let valid_lower = chunk.simd_ge(Simd::splat(b'a')) & chunk.simd_le(Simd::splat(b'f'));
let valid = valid_digit | valid_upper | valid_lower;
valid.all()
}
I expected to see this happen: optimizes as well as the hand-rolled x86 version
Instead, this happened: doesn't, see godbolt
Meta
rustc --version --verbose
:
rustc 1.91.0-nightly (1ebbd87a6 2025-08-11)
binary: rustc
commit-hash: 1ebbd87a62ce96a72b22da61b7c2c43893534842
commit-date: 2025-08-11
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: BugCategory: Bug