-
Notifications
You must be signed in to change notification settings - Fork 13.3k
simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors #137953
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
Conversation
r? @Nadrieril rustbot has assigned @Nadrieril. Use |
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_gcc Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr Some changes occurred to the platform-builtins intrinsics. Make sure the cc @antoyo, @GuillaumeGomez, @bjorn3, @calebzulawski, @programmerjake |
This comment has been minimized.
This comment has been minimized.
48bc564
to
26cb001
Compare
@bjorn3 anything we have to do here in cranelift? |
26cb001
to
fa396bc
Compare
r? codegen |
fa396bc
to
edadfc4
Compare
Some changes occurred in compiler/rustc_codegen_ssa |
@workingjubilee this has been sitting here for a while. Should I roll another reviewer? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with/out the nit
@@ -133,8 +133,7 @@ codegen_ssa_invalid_monomorphization_inserted_type = invalid monomorphization of | |||
|
|||
codegen_ssa_invalid_monomorphization_invalid_bitmask = invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$mask_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]` | |||
|
|||
codegen_ssa_invalid_monomorphization_mask_type = invalid monomorphization of `{$name}` intrinsic: found mask element type is `{$ty}`, expected a signed integer type | |||
.note = the mask may be widened, which only has the correct behavior for signed integers | |||
codegen_ssa_invalid_monomorphization_mask_wrong_element_type = invalid monomorphization of `{$name}` intrinsic: found mask element type is `{$ty}`, expected an integer type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the more common order is expected: ..., found: ...
, not found: ..., expected: ...
like here.
I don't think so. cg_clif doesn't actually check the lane type in many cases. Just that the vector argument is actually a vector. |
edadfc4
to
566dfd1
Compare
@bors r=WaffleLapkin |
…enton Rollup of 5 pull requests Successful merges: - rust-lang#137953 (simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors) - rust-lang#139990 (transmutability: remove NFA intermediate representation) - rust-lang#140044 (rustc-dev-guide subtree update) - rust-lang#140051 (Switch exploit mitigations to mdbook footnotes) - rust-lang#140054 (docs: fix typo change from inconstants to invariants) r? `@ghost` `@rustbot` modify labels: rollup
…enton Rollup of 5 pull requests Successful merges: - rust-lang#137953 (simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors) - rust-lang#139990 (transmutability: remove NFA intermediate representation) - rust-lang#140044 (rustc-dev-guide subtree update) - rust-lang#140051 (Switch exploit mitigations to mdbook footnotes) - rust-lang#140054 (docs: fix typo change from inconstants to invariants) r? `@ghost` `@rustbot` modify labels: rollup
…enton Rollup of 5 pull requests Successful merges: - rust-lang#137953 (simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors) - rust-lang#139990 (transmutability: remove NFA intermediate representation) - rust-lang#140044 (rustc-dev-guide subtree update) - rust-lang#140051 (Switch exploit mitigations to mdbook footnotes) - rust-lang#140054 (docs: fix typo change from inconstants to invariants) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137953 - RalfJung:simd-intrinsic-masks, r=WaffleLapkin simd intrinsics with mask: accept unsigned integer masks, and fix some of the errors It's not clear at all why the mask would have to be signed, it is anyway interpreted bitwise. The backend should just make sure that works no matter the surface-level type; our LLVM backend already does this correctly. The note of "the mask may be widened, which only has the correct behavior for signed integers" explains... nothing? Why can't the code do the widening correctly? If necessary, just cast to the signed type first... Also while we are at it, fix the errors. For simd_masked_load/store, the errors talked about the "third argument" but they meant the first argument (the mask is the first argument there). They also used the wrong type for `expected_element`. I have extremely low confidence in the GCC part of this PR. See [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/257879-project-portable-simd/topic/On.20the.20sign.20of.20masks)
It's not clear at all why the mask would have to be signed, it is anyway interpreted bitwise. The backend should just make sure that works no matter the surface-level type; our LLVM backend already does this correctly. The note of "the mask may be widened, which only has the correct behavior for signed integers" explains... nothing? Why can't the code do the widening correctly? If necessary, just cast to the signed type first...
Also while we are at it, fix the errors. For simd_masked_load/store, the errors talked about the "third argument" but they meant the first argument (the mask is the first argument there). They also used the wrong type for
expected_element
.I have extremely low confidence in the GCC part of this PR.
See discussion on Zulip