Skip to content

Implement SIMD funnel shift intrinsics - #1698

Open
Sonike wants to merge 1 commit into
rust-lang:mainfrom
Sonike:fix/simd-funnel-shifts
Open

Implement SIMD funnel shift intrinsics#1698
Sonike wants to merge 1 commit into
rust-lang:mainfrom
Sonike:fix/simd-funnel-shifts

Conversation

@Sonike

@Sonike Sonike commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • lower simd_funnel_shl and simd_funnel_shr lane by lane with Cranelift integer operations
  • use logical right shifts so signed and unsigned lanes keep the required bitwise semantics
  • handle zero shifts explicitly and construct the lane-width constant safely for 128-bit lanes
  • re-enable tests/ui/simd/intrinsic/generic-arithmetic-pass.rs in the rustc test suite

The implementation follows the existing scalarized SIMD lowering strategy. Native vector instructions can be considered separately in the future.

Testing

  • cargo fmt --check
  • ./y.sh build
  • ./test.sh
  • compiled and ran the upstream generic-arithmetic-pass.rs test against this backend
  • compiled and ran focused assertions covering unsigned and signed 32-bit lanes, 128-bit lanes, and shift counts including zero and the maximum valid count

Fixes #1696

Lower simd_funnel_shl and simd_funnel_shr lane by lane, including zero-shift and i128 handling. Re-enable the upstream generic arithmetic test.
@Sonike

Sonike commented Aug 29, 2026

Copy link
Copy Markdown
Author

CI note: test_llvm failed in randomized portable-simd f32 simd_min/simd_max property tests involving NaNs and signed zero. This job runs ./y.sh test --use-backend llvm; the workflow explicitly notes that it does not exercise cg_clif. The cg_clif build, targeted upstream regression test, local full suite, and completed cross-platform PR jobs all pass.

I attempted to rerun only the failed job, but GitHub requires repository admin permission for an upstream workflow rerun. A maintainer rerun should confirm whether the randomized LLVM-only test is flaky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement simd_funnel_shl and simd_funnel_shr intrinsics

1 participant