rust-lang / rust-lang/rustc_codegen_cranelift
Implement simd_funnel_shl and simd_funnel_shr intrinsics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 157
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 3
Description
Summary
rustc_codegen_cranelift does not implement the simd_funnel_shl and simd_funnel_shr intrinsics. Code using them fails to compile with:
error: Unknown SIMD intrinsic simd_funnel_shl
error: Unknown SIMD intrinsic simd_funnel_shr
This blocks the rustc test tests/ui/simd/intrinsic/generic-arithmetic-pass.rs, which is currently skipped in scripts/test_rustc_tests.sh with the comment unimplemented simd_funnel_{shl,shr}.
Reproduce
#![feature(repr_simd, core_intrinsics)]
#![allow(non_camel_case_types)]
use std::intrinsics::simd::{simd_funnel_shl, simd_funnel_shr};
#[repr(simd)]
#[derive(Copy, Clone)]
struct i32x4([i32; 4]);
fn main() {
let x = i32x4([1, 2, 3, 4]);
let y = i32x4([2, 3, 4, 5]);
unsafe {
let _ = simd_funnel_shl(x, y, x);
let _ = simd_funnel_shr(x, y, x);
}
}
rustc -Zcodegen-backend=cranelift repro.rs
btw simd_shl and simd_shr are already implemented in src/intrinsics/simd.rs
Funnel shifts combine bits from two vectors according to a per lane shift amount
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/intrinsics/simd.rs, comparing the existing simd_shl and simd_shr implementations with the missing funnel-shift intrinsics. Review scripts/test_rustc_tests.sh and tests/ui/simd/intrinsic/generic-arithmetic-pass.rs, then reproduce the example with the Cranelift backend. Done means both intrinsics compile and the previously skipped rustc test runs successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100