Repository navigation
Conversation
|
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr
cc @bjorn3
cc @rust-lang/clippy
cc @rust-lang/miri
Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Any special-casing of Miri in the standard library requires review. cc @rust-lang/miri
cc @rust-lang/wg-const-eval
cc @rust-lang/wg-const-eval Some changes occurred to the CTFE machinery |
|
|
I just realized that we can maybe just use |
|
doesn't that feel a bit hackier / risk prone that just doing it like this? though i don't mind, we are calling externs from |
This comment has been minimized.
This comment has been minimized.
IMO it makes sense -- in both cases it's a fallback body that we don't want to use for const-eval, just the reason for not using it is different. |
|
CI is red. Also please add the same kind of test as in your other PR. Yeah that means they will conflict -- sorry for that. Shouldn't be too hard of a conflict to deal with I hope. @rustbot author |
1514b9c to
101eb51
Compare
|
de-constified the trait, as done in #162409, and switched to |
There was a problem hiding this comment.
LGTM on the Rust + LLVM side, but I can't review the other codegen backends. Looks like the GCC changes already got approved -- @bjorn3 could you look at the cranelift changes?
This comment has been minimized.
This comment has been minimized.
| // Check that the float intrinsics carrying `#[rustc_do_not_const_check]` can actually be called in | ||
| // a const context, for every float width. Their bodies are never const-checked and never run by | ||
| // const-eval, which has to implement each of these intrinsics itself. |
There was a problem hiding this comment.
FWIW there's no good reason to only cover rustc_do_not_const_check intrinsics here. All const intrinsics without const-capable fallback body should ideally be covered somewhere. Maybe we already test some of them somewhere? I don't know.
101eb51 to
4b1bf47
Compare
This comment has been minimized.
This comment has been minimized.
4b1bf47 to
37ea318
Compare
|
@rustbot ready i think i addressed all outstanding comments! |
|
The LLVM and const-eval part is all good. |
…rtdev Make more float intrinsics generic Another (big) step of rust-lang#153834 + rust-lang#160989 Makemore remaining float intrinsics generic! Each commit is self-contained. In order: - `ceil`, `floor`, `trunc`, `round`, `round_ties_even`, with const libm fallbacks (using `#[rustc_do_not_const_check]`, see rust-lang#150961, cc @RalfJung @tgross35) - `sqrt`, with libm fallbacks - `powf`, with libm fallbacks - `fma` and `fmuladd`, with libm fallbacks (+`#[rustc_do_not_const_check]`) and a shared fallback, respectively. - `powi`, with no fallback (it already didn't have any) The first commit just removes the f16/f128 fallbacks for `fabs`, as mentioned [here](rust-lang#160989 (comment)). I didn't try making the backends use more fallbacks, to make the PR less risky since it's quite large. Happy to do changes there though (cc @folkertdev) `copysign`, `minimum_number_nsz`, `maximum_number_nsz`, `minimum`, `maximum` will be handled separately as they require `rustc_allow_const_fn_unstable`: rust-lang#162414
Rollup merge of #162395 - N1ark:more-float-generics, r=folkertdev Make more float intrinsics generic Another (big) step of #153834 + #160989 Makemore remaining float intrinsics generic! Each commit is self-contained. In order: - `ceil`, `floor`, `trunc`, `round`, `round_ties_even`, with const libm fallbacks (using `#[rustc_do_not_const_check]`, see #150961, cc @RalfJung @tgross35) - `sqrt`, with libm fallbacks - `powf`, with libm fallbacks - `fma` and `fmuladd`, with libm fallbacks (+`#[rustc_do_not_const_check]`) and a shared fallback, respectively. - `powi`, with no fallback (it already didn't have any) The first commit just removes the f16/f128 fallbacks for `fabs`, as mentioned [here](#160989 (comment)). I didn't try making the backends use more fallbacks, to make the PR less risky since it's quite large. Happy to do changes there though (cc @folkertdev) `copysign`, `minimum_number_nsz`, `maximum_number_nsz`, `minimum`, `maximum` will be handled separately as they require `rustc_allow_const_fn_unstable`: #162414
This comment has been minimized.
This comment has been minimized.
37ea318 to
4fb0643
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
View all comments
Split off from #162395
Make the following intrinsics generic over the float type:
copysign, with a shared fallback (bit manipulations). Note that this required adding#[rustc_const_unstable]to the whole intrinsic, whichcopysignf16andcopysignf128didn't have. This was already FCP'd, see rust-lang/rust#153834 (comment).minimum_number_nsz,maximum_number_nsz,minimum,maximum, with shared fallbacks.Because these are generic and require const trait impls to have a fallback, I had to add
#[rustc_allow_const_fn_unstable]to them:copysignneedsconst_ops,const_trait_implminimum_number_nszandmaximum_number_nszneedconst_cmp,const_trait_implminimumandmaximumneedconst_cmp,const_ops,const_trait_implI have also bundled in the addition of the attribute to
fabs, which used these features without having a formal approval (see #162409 -- this was introduced in #153834)See #162395 (comment)
r? RalfJung