Open
Description
I tried this code:
Godbolt
#![feature(portable_simd)]
use std::simd::*;
pub fn increment(idx: Simd<u32, 8>, arr: &mut [u32]) {
assert!(
(arr.len() >= u32::MAX as usize)
|| idx.simd_lt(Simd::splat(arr.len() as u32)).all()
);
idx.as_array().iter().for_each(|i| arr[*i as usize] += 1);
}
I expected to see this happen: Bounds checks are eliminated and there is the vpcmpltd
instruction
Instead, this happened: Bounds checks are not eliminated and a vpmaxud
and vpcmpeqd
pair is used
Meta
RUSTC_BOOTSTRAP=1 rustc --version --verbose
:
rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-unknown-linux-gnu
release: 1.70.0
LLVM version: 16.0.2