Add unchecked_disjoint_bitor per ACP373 - #135760
Conversation
|
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @rust-lang/wg-const-eval |
| fn or(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value; | ||
| /// Defaults to [`Self::or`], but guarantees `(lhs & rhs) == 0` so some backends | ||
| /// can emit something more helpful for optimizations. | ||
| fn or_disjoint(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value { |
There was a problem hiding this comment.
Why is this a method and not just a normal intrinsic? Why does this have 2 default implementations? (fallback in core and default impl here)
There was a problem hiding this comment.
So that other places in cg_ssa can use it if it's helpful.
The fallback one in core is for clif and ctfe, whereas the one here is for gcc.
There was a problem hiding this comment.
Kinda annoying that we need 2 fallbacks :(
There was a problem hiding this comment.
Is this what we do for all intrinsics that can't be implemented in cg_ssa? Isn't there some place where cg_llvm matches on the intrinsic name to provide its own impls before falling back to the cg_ssa one?
There was a problem hiding this comment.
I could do that, it just feels like a worse fit here.
This isn't like these intrinsics
rust/compiler/rustc_codegen_llvm/src/intrinsic.rs
Lines 29 to 154 in a30f915
where we're lowering it to some call, or the ones depending on LLVM-only integer types, or whatever.
It's far more like add nuw, where we have add, unchecked_sadd, and unchecked_uadd on BuilderMethods, because it's an instruction in the IR and something that we can use in other places in MIR-to-Backend lowering. (For example, we could use it in emitting rotates since we might as well and it's no less safe than the shifts that are also unchecked in the builder.)
And sure, those two unchecked examples don't have defaults today, but they should, because cg_gcc is just emitting self.gcc_add(a, b) for all three anyway, and if we want cg_ssa to be useful it shouldn't require implementing these when there's perfectly fine -- albeit potentially suboptimal -- provided implementations.
commented
Jan 22, 2025
|
The Miri subtree was changed cc @rust-lang/miri |
commented
Jan 22, 2025
|
Added some miri-conditional |
ae46ade to
5e6ae8b
Compare
commented
Feb 1, 2025
|
@bors r+ |
commented
Feb 1, 2025
commented
Feb 1, 2025
|
@bors r- |
commented
Feb 2, 2025
|
@bors try |
commented
Feb 2, 2025
|
@bors r- |
commented
Feb 2, 2025
This comment has been minimized.
This comment has been minimized.
commented
Feb 2, 2025
|
💔 Test failed - checks-actions |
|
The problem was this LLVM assertion: |
commented
Feb 3, 2025
|
Oh, does CI not have assertions enabled? b987aa5 triggered it locally for me. |
b987aa5 to
f46e6be
Compare
|
Turns out that You can see that the upstream |
commented
Feb 3, 2025
|
@bors r=WaffleLapkin rollup=iffy (failed in rollup last time, but I repro'd it locally and fixed) |
commented
Feb 3, 2025
commented
Feb 4, 2025
commented
Feb 4, 2025
|
☀️ Test successful - checks-actions |
commented
Feb 4, 2025
|
Finished benchmarking commit (3f33b30): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.7%, secondary 2.6%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 778.094s -> 778.717s (0.08%) |
Following the names from libs-api in rust-lang/libs-team#373 (comment)
Includes a fallback implementation so this doesn't have to update cg_clif or cg_gcc, and overrides it in cg_llvm to use
or disjoint, which is available in LLVM 18 so hopefully we don't need any version checks.