-
Notifications
You must be signed in to change notification settings - Fork 277
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
[tbm] fix bextri #190
[tbm] fix bextri #190
Conversation
@alexcrichton so i've splitted the bextri fix here. We could change the API of functions taking immediate values to: fn bextri_u32<const imm: u32>(x: u32); but what I'd like to see is: fn bextri_u32(x: u32, const imm: u32); @withoutboats @eddyb thoughts ? |
We can special-case some intrinsics to require a constant argument - we've successfully done this for shuffles, which means they get a constant checking error instead of a post-monomorphization one. As for the feature of an argument being constant... I think I'd prefer |
That looks great. I want to add that this PR does not introduce this problem. The From The first one is compile-times. The second problem is safety. Some of the intrinsics require I think that for Whether this deserves a language level solution or not I don't know. @alexcrichton I don't know what I should do about this PR. I don't want it to rotten but I don't want it to slow compile-times by a factor of 3 either. Iff we are going to fix this in trans we should probably fix the other intrinsics requiring immediate arguments as well, but this significantly raises the barrier of entry for people wanting to contribute to the library an intrinsic that requires immediate mode arguments. IIRC |
Note that the special-casing would still have to be made in the compiler, the difference with using the |
Currently the |
@gnzlbg I meant if you wanted to write them as |
Ok thanks for the PR @gnzlbg! I think though that this is a case where I'd personally prefer at least to hold out for a language feature like |
@alexcrichton I agree. The only workaround for the current state of affairs that I can think of is to use associated consts: // stdsimd:
pub trait bextri_64 {
const IMM: u64;
fn bextri_u64(x: u64) -> u64 {
llvm_bextri(x, Self::IMM)
}
}
// user
struct V2();
impl bextri_u64 for V {
const IMM: u64 = 2;
} but... this is a weird thing to do this. |
No description provided.