Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support #[rustc_args_required_const(...)] for simd intrinsics #666

Closed
bjorn3 opened this issue Aug 13, 2019 · 4 comments
Closed

Support #[rustc_args_required_const(...)] for simd intrinsics #666

bjorn3 opened this issue Aug 13, 2019 · 4 comments
Labels
A-core-arch Area: Necessary for full core::arch support help wanted Extra attention is needed

Comments

@bjorn3
Copy link
Member

bjorn3 commented Aug 13, 2019

For example:

// https://github.com/rust-lang/stdarch/blob/ef6b0690192f1cfc753af698695c2ecde0c7b991/crates/core_arch/src/x86_64/avx2.rs#L31
#[rustc_args_required_const(1)]
pub unsafe fn _mm256_extract_epi64(a: __m256i, imm8: i32) -> i64 {
    let imm8 = (imm8 & 3) as u32;
    simd_extract(a.as_i64x4(), imm8)
}

Calling these kind of intrinsics will currently panic with a message like: simd_extract* idx not const: "move _8".

@bjorn3 bjorn3 added the C-bug Category: This is a bug. label Aug 13, 2019
@bjorn3 bjorn3 added this to the MVP milestone Aug 13, 2019
@bjorn3 bjorn3 mentioned this issue Aug 13, 2019
15 tasks
@bjorn3
Copy link
Member Author

bjorn3 commented Aug 15, 2019

Using -Zmir-opt-level=3 doesn't help. While the function gets inlined, there is no constant propagation performed to get rid of the (imm & 3) as u32 part.

@bjorn3 bjorn3 added the help wanted Extra attention is needed label Aug 16, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Aug 16, 2019

I made these functions panic at runtime for now.

@bjorn3 bjorn3 removed this from the MVP milestone Sep 1, 2019
@bjorn3 bjorn3 added the A-core-arch Area: Necessary for full core::arch support label Sep 14, 2019
@bjorn3 bjorn3 removed the C-bug Category: This is a bug. label Oct 2, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Mar 22, 2020

Fixing rust-lang/rust#70271 would fix this.

@bjorn3
Copy link
Member Author

bjorn3 commented Mar 22, 2020

@bjorn3 bjorn3 closed this as completed in 49b7fac Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core-arch Area: Necessary for full core::arch support help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant