Page MenuHomePhabricator

[Win64] Handle FP arguments more gracefully under -mno-sse
Needs ReviewPublic

Authored by rnk on Tue, Nov 19, 2:38 PM.

Details

Summary

Pass small FP values in GPRs or stack memory according the the normal
convention. This is what gcc -mno-sse does on Win64.

Event Timeline

rnk created this revision.Tue, Nov 19, 2:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Nov 19, 2:38 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

Is a compiler abort not preferable to generating non-ABI conforming code?

rnk added a comment.Tue, Nov 19, 3:26 PM

Well, specifically for the MSVC side of things, they don't implement a -mno-sse mode:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/da46257b-4d92-402f-b320-b727341f6d30/disabling-ssesse2-code-generation-in-64bit-builds?forum=vcgeneral
So, we have to make up our own rules anway.

I suppose we might as well follow GCC, then. I see they pass in GPRs in this case. Let's do that.

Isn't this passing by memory not by X87?

I'm not opposed to supporting a soft-float ABI. But I don't think -mno-sse is a strong enough signal that the user actually understands what they're asking for, as opposed to being an accidental leftover from a 32-bit project. I'd prefer to print an error.

rnk updated this revision to Diff 230174.Tue, Nov 19, 4:38 PM
  • follow GCC
rnk added a comment.Tue, Nov 19, 4:40 PM

I'm not opposed to supporting a soft-float ABI. But I don't think -mno-sse is a strong enough signal that the user actually understands what they're asking for, as opposed to being an accidental leftover from a 32-bit project. I'd prefer to print an error.

Well, -mno-sse seems to be enough to get GCC to do a soft-floatish thing, so I'm really just trying to follow them here. I think what we're finding in practice is that simply implementing the functionality we didn't intend to support is actually easier than nailing down the corner cases under which we should emit an error and recovering correctly.

Isn't this passing by memory not by X87?

You're right, it was. Now it converts to i32/i64, which goes via RCX/RDX/etc then stack memory.

rnk edited the summary of this revision. (Show Details)Mon, Nov 25, 1:15 PM
rnk updated this revision to Diff 230963.Mon, Nov 25, 1:16 PM
  • rebase
rnk added a comment.Mon, Dec 9, 4:37 PM

Any thoughts on this?