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

No "weird" floats in const fn {from,to}_bits #95971

Merged
merged 4 commits into from
Apr 23, 2022

Conversation

workingjubilee
Copy link
Member

I suspect this code is subtly incorrect and that we don't even e.g. use x87-style floats in CTFE, so I don't have to guard against that case. A future PR will be hopefully removing them from concern entirely, anyways. But at the moment I wanted to get this rolling because small questions like that one seem best answered by review.

r? @oli-obk
cc @eddyb @thomcc

Careful handling does its best to take care of both Armv7's
"unenhanced" Neon as well as the x87 FPU.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 12, 2022
@rust-highfive
Copy link
Collaborator

Thank you for submitting a new PR for the library teams! If this PR contains a stabilization of a library feature that has not already completed FCP in its tracking issue, introduces new or changes existing unstable library APIs, or changes our public documentation in ways that create new stability guarantees then please comment with r? rust-lang/libs-api @rustbot label +T-libs-api to request review from a libs-api team reviewer. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 12, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Apr 12, 2022

oof. What you write makes sense, but I have no way of verifying it beyond looking at the CTFE logic and agreeing that it makes sense.

we don't even e.g. use x87-style floats in CTFE, so I don't have to guard against that case.

yea, we don't. Our impl is "perfectly IEEE compliant". I am fully aware how useless that fact is, considering hardware and LLVM do what they do.

@workingjubilee
Copy link
Member Author

oof. What you write makes sense, but I have no way of verifying it beyond looking at the CTFE logic and agreeing that it makes sense.

we don't even e.g. use x87-style floats in CTFE, so I don't have to guard against that case.

yea, we don't. Our impl is "perfectly IEEE compliant". I am fully aware how useless that fact is, considering hardware and LLVM do what they do.

That's fine! It's my job to bring those two more into alignment, one way or another. 😈

@workingjubilee
Copy link
Member Author

workingjubilee commented Apr 23, 2022

Fixed up comments and removed unnecessary x87-specific logic for const time.

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 23, 2022

This gets us closer to floats in const fn. I'll address the use of const_eval_select after this is merged.

@bors r+

@bors
Copy link
Contributor

bors commented Apr 23, 2022

📌 Commit 4da8682 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2022
@bors
Copy link
Contributor

bors commented Apr 23, 2022

⌛ Testing commit 4da8682 with merge cacaef022ae549251cf088cf0e2cf93abb505675...

@bors
Copy link
Contributor

bors commented Apr 23, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 23, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.......... (60/62)
.         (62/62)


/checkout/src/test/rustdoc-gui/search-tab-selection-if-current-is-empty.goml search-tab-selection-if-current-is-empty... FAILED
[ERROR] (line 6) TimeoutError: waiting for selector "#titles" failed: timeout 30000ms exceeded: for command `wait-for: "#titles"`
Build completed unsuccessfully in 0:00:45

@oli-obk
Copy link
Contributor

oli-obk commented Apr 23, 2022

@bors retry TimeoutError: waiting for selector "#titles" failed: timeout 30000ms

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2022
@bors
Copy link
Contributor

bors commented Apr 23, 2022

⌛ Testing commit 4da8682 with merge 1e9aa8a...

@bors
Copy link
Contributor

bors commented Apr 23, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 1e9aa8a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 23, 2022
@bors bors merged commit 1e9aa8a into rust-lang:master Apr 23, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 23, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1e9aa8a): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@RalfJung
Copy link
Member

RalfJung commented Jun 1, 2022

Should the doc comments of these functions explicitly mention their restrictions when used in const context?

@workingjubilee
Copy link
Member Author

Probably would be best if they did, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants