Page MenuHomePhabricator

[X86][ABI] Do not return float/double from x87 registers when x87 is disabled

Authored by pengfei on Oct 20 2021, 8:32 AM.



This is aligned with GCC's behavior.
Also, alias -mno-fp-ret-in-387 to -mno-x87, by which we can fix pr51498.

Diff Detail

Event Timeline

pengfei created this revision.Oct 20 2021, 8:32 AM
pengfei requested review of this revision.Oct 20 2021, 8:32 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 20 2021, 8:32 AM
pengfei planned changes to this revision.Oct 20 2021, 7:25 PM

Found a mistake, working on that.

pengfei updated this revision to Diff 381179.Oct 21 2021, 1:47 AM

Fix bugs. Ready for review now.

Yes. I mentioned pr51498 in commit message :)

sorry, I missed the PR # in the description; my mistake.


If you split this test and the above change to clang/include/clang/Driver/ into a separate patch on Phab, I'd be happy to accept that!

Otherwise someone more familiar with x86 will have to take a look at the below changes.

pengfei added inline comments.Mon, Nov 15, 4:47 AM

This is a simple alias. Spliting it doesn't solve the initial problem. I think it's better to commit it together with the backend change.

nickdesaulniers accepted this revision.Tue, Nov 16, 12:55 PM

Just a comment on the ECX bit, otherwise this patch looks fine to me. Someone with more x86 knowledge may want to take a look though. Thanks for the patch!


Is there a test case that exercises the assignment to %ecx?

This revision is now accepted and ready to land.Tue, Nov 16, 12:55 PM
pengfei updated this revision to Diff 387855.Wed, Nov 17, 12:32 AM
  1. Add support for f80.
  2. Add test case for 3 return values.
pengfei added inline comments.Wed, Nov 17, 12:38 AM

Add one test case for it, though I don't believe we can really generate it from frontend.

nickdesaulniers accepted this revision.Wed, Nov 17, 10:24 AM
nickdesaulniers added inline comments.


Thanks for the review!


Will fix it as a follow up. D100091 aims to fix these problems.