Skip to content

Implement simd_funnel_shl and simd_funnel_shr intrinsics #1696

Description

@0xmuon

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions