Skip to content

Conversation

@beetrees
Copy link
Contributor

@beetrees beetrees commented Apr 2, 2024

Solves #115567 for the (default) "Rust" ABI. When compiling for 32-bit x86, this PR changes the "Rust" ABI to return floats indirectly instead of in x87 registers (with the exception of single f32s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the "C" ABI as that ABI requires x87 register usage and therefore will need a different solution.

@rustbot
Copy link
Collaborator

rustbot commented Apr 2, 2024

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 2, 2024
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes lgtm, but I'm not an ABI expert

@compiler-errors
Copy link
Member

so let's get another look at it

r? compiler

@rustbot rustbot assigned Nadrieril and unassigned compiler-errors Apr 2, 2024
@Nadrieril
Copy link
Member

Not an ABI expert either

r? compiler

@rustbot rustbot assigned oli-obk and unassigned Nadrieril Apr 2, 2024
@Nadrieril

This comment has been minimized.

@rustbot rustbot assigned fmease and unassigned oli-obk Apr 2, 2024
Copy link
Member

@fmease fmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me, too. I'm also not an expert on this matter ^^'.
@RalfJung, could you help us out?

@beetrees beetrees force-pushed the x86-ret-snan-rust branch 2 times, most recently from c413b2f to c42c4b5 Compare April 13, 2024 00:59
@beetrees
Copy link
Contributor Author

I've added a commit to update platform-support.md to reflect the current state of #115567 after this PR (I had to rebase to avoid conflicts in platform-support.md). I also fixed the issue number to point to the correct issue.

@RalfJung
Copy link
Member

Looks reasonable to me, too. I'm also not an expert on this matter ^^'. @RalfJung, could you help us out?

My name appears in these issues as I gained just enough knowledge to identify that we have a problem, but I don't feel confident to approve any changes to our ABI, sorry.

With my limited knowledge however, this change does make a lot of sense. And it's a lot simpler than what I thought was necessary to do this. Very nice!

So... who is an ABI expert? @bjorn3, @nikic and @eddyb are the first people coming to my mind.

(Maybe we should have some sort of dedicated ABI expert ping group. It would be really good to have some people in charge of ABI-related questions.)

@beetrees beetrees force-pushed the x86-ret-snan-rust branch from c42c4b5 to 852ffd3 Compare April 13, 2024 19:33
@programmerjake
Copy link
Member

programmerjake commented Apr 23, 2024

I guess it can be left for a followup, but if SSE2 is available, I think f32/f64 should be returned in xmm0 instead of in memory, since the XMM registers are where all the math is done anyway. This can be done by setting the inreg LLVM parameter attribute on the return type:

https://github.com/llvm/llvm-project/blob/575a6483062b8a77b35f48589b2acc1020195ac7/llvm/lib/Target/X86/X86CallingConv.td#L300-L304

@beetrees
Copy link
Contributor Author

@programmerjake See #115919 - currently blocked on #116584. I agree it would be a good future improvement once the target feature issues have been sorted out.

@beetrees
Copy link
Contributor Author

Picking one of the people mentioned by @RalfJung earlier:

r? @bjorn3

@rustbot rustbot assigned bjorn3 and unassigned fmease May 16, 2024
@bjorn3
Copy link
Member

bjorn3 commented May 18, 2024

I don't have time to review this for the next two weeks at least unfortunately.

@beetrees
Copy link
Contributor Author

No worries. I'll try someone else.

r? @nikic

@bors
Copy link
Collaborator

bors commented Jul 12, 2024

⌛ Testing commit cae9d48 with merge c2437cb...

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Collaborator

bors commented Jul 12, 2024

💔 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 Jul 12, 2024
@beetrees
Copy link
Contributor Author

error: failed to remove file `C:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\release\cargo.exe`

Caused by:
  Access is denied. (os error 5)

Error appears to be spurious.

@Kobzol
Copy link
Member

Kobzol commented Jul 12, 2024

@bors r=nikic,workingjubilee

@bors
Copy link
Collaborator

bors commented Jul 12, 2024

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.
  • There's another pull request that is currently being tested, blocking this pull request: [do not merge] Testing Windows CI #127373

@bors
Copy link
Collaborator

bors commented Jul 12, 2024

📌 Commit cae9d48 has been approved by nikic,workingjubilee

It is now in the queue for this repository.

@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 Jul 12, 2024
@bors
Copy link
Collaborator

bors commented Jul 12, 2024

⌛ Testing commit cae9d48 with merge c6727fc...

@bors
Copy link
Collaborator

bors commented Jul 12, 2024

☀️ Test successful - checks-actions
Approved by: nikic,workingjubilee
Pushing c6727fc to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 12, 2024
@bors bors merged commit c6727fc into rust-lang:master Jul 12, 2024
@rustbot rustbot added this to the 1.81.0 milestone Jul 12, 2024
@beetrees beetrees deleted the x86-ret-snan-rust branch July 12, 2024 23:26
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c6727fc): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 703.434s -> 705.609s (0.31%)
Artifact size: 328.58 MiB -> 328.61 MiB (0.01%)

@workingjubilee workingjubilee added the O-x86_32 Target: x86 processors, 32 bit (like i686-*) (also known as IA-32, i386, i586, i686) label Jul 18, 2024
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. O-x86_32 Target: x86 processors, 32 bit (like i686-*) (also known as IA-32, i386, i586, i686) 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.