This is an archive of the discontinued LLVM Phabricator instance.

[Power PC] add soft float support for ppc32
ClosedPublic

Authored by spetrovic on Oct 1 2015, 9:37 AM.

Details

Summary

This patch enables soft float support for ppc32 architecture and fixes the ABI for variadic functions. This is first in set of patches for soft float support in LLVM.

Diff Detail

Repository
rL LLVM

Event Timeline

spetrovic updated this revision to Diff 36260.Oct 1 2015, 9:37 AM
spetrovic retitled this revision from to [Power PC] add soft float support for ppc32.
spetrovic updated this object.
spetrovic added a reviewer: hfinkel.
spetrovic added a subscriber: cfe-commits.
alexr added a subscriber: alexr.Oct 1 2015, 2:00 PM

PowerPC has floating point hardware by definition. Is this some new variant?

annulen added a subscriber: annulen.Oct 2 2015, 6:37 AM

02.10.2015, 00:00, "Alex Rosenberg via cfe-commits" <cfe-commits@lists.llvm.org>:

alexr added a subscriber: alexr.
alexr added a comment.

PowerPC has floating point hardware by definition. Is this some new variant?

Some cores from ppc400 series do not have hardware FP (for example, ppc 405)

spetrovic updated this revision to Diff 36763.Oct 7 2015, 10:31 AM
hfinkel added inline comments.Oct 27 2015, 5:13 PM
include/clang/Basic/TargetInfo.h
688 ↗(On Diff #36763)

Instead of adding this function, please use the same mechanism as X86_32TargetCodeGenInfo and X86_32ABIInfo to feed the soft-float abi information through.

lib/Basic/Targets.cpp
877 ↗(On Diff #36763)

Add spaces after { and before }.

1072 ↗(On Diff #36763)

This check can be part of the loop above.

lib/Driver/Tools.cpp
1372 ↗(On Diff #36763)

Unless there is a good reason to consider all unknown strings equivalent to "hard", please produce an error (and an associated test case).

test/Driver/ppc-features.cpp
18 ↗(On Diff #36763)

Also add a test case with -mhard-float, and both -msoft-float and -mhard-float in different orders.
Also add test cases with -mfloat-abi=X

spetrovic updated this revision to Diff 38882.Nov 2 2015, 2:51 AM
spetrovic marked 5 inline comments as done.

Comments addressed.

spetrovic updated this revision to Diff 38888.Nov 2 2015, 3:28 AM

added test case

hfinkel edited edge metadata.Nov 10 2015, 2:25 PM

Can you please make sure we produce some sensible error should someone try to use soft float with ppc64 (since we don't support that), and add an associated test.

lib/Driver/Tools.h
739 ↗(On Diff #38888)

We don't seem to support (or even accept) SoftFP. Given that, either remove it from the enum or add support for it.

742 ↗(On Diff #38888)

Unindent this and ppc::FloatABI -> FloatABI

spetrovic updated this revision to Diff 40143.Nov 13 2015, 5:24 AM
spetrovic edited edge metadata.
spetrovic set the repository for this revision to rL LLVM.
spetrovic marked 2 inline comments as done.

Comments addressed.

spetrovic removed rL LLVM as the repository for this revision.Nov 13 2015, 5:27 AM
hfinkel added inline comments.Nov 23 2015, 4:46 PM
lib/CodeGen/TargetInfo.cpp
3421 ↗(On Diff #40143)

Line too long.

lib/Driver/Tools.cpp
1353 ↗(On Diff #40143)

Remove this FIXME. It is not clear this will ever be supported (is there actually ppc64 hardware without an FP unit)?

1362 ↗(On Diff #40143)

Don't introduce a new error for this. Just reuse the diag::err_drv_invalid_mfloat_abi error.

spetrovic updated this revision to Diff 41736.Dec 3 2015, 4:01 AM
spetrovic marked 3 inline comments as done.
spetrovic added inline comments.Dec 3 2015, 4:09 AM
lib/Driver/Tools.cpp
1439 ↗(On Diff #41736)

I'm planning to support soft float for ppc64. At this moment I don't know name of ppc64 hardware without FP unit. I know that gcc supports soft float for ppc64.

hfinkel accepted this revision.Dec 10 2015, 5:41 AM
hfinkel edited edge metadata.

One minor comment, otherwise LGTM.

lib/Driver/Tools.cpp
1477 ↗(On Diff #41736)

Don't need the { } here.

This revision is now accepted and ready to land.Dec 10 2015, 5:41 AM
rjmccall added inline comments.Dec 10 2015, 7:56 AM
lib/Driver/Tools.cpp
1477 ↗(On Diff #41736)

We don't seem to have a specific style guideline *mandating* the uses of braces around even single-line statements, but please don't *discourage* them.

hfinkel added inline comments.Dec 10 2015, 9:20 AM
lib/Driver/Tools.cpp
1477 ↗(On Diff #41736)

I don't believe this represents the current consensus convention on this matter. We do actively discourage use of unnecessary braces for ifs, fors, etc. The exception being that a series of ifs and elses should have braces for all of them if any of them need them.

I often point people at the examples here as representative: http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

You're right, however, we don't formally dictate this policy in our coding standards. Do you actively dislike this viewpoint?

rjmccall added inline comments.Dec 10 2015, 10:25 AM
lib/Driver/Tools.cpp
1477 ↗(On Diff #41736)

The coding style document uses both styles fairly interchangeably; I would not say it states a consensus. And yes, I actively encourage people to add braces in code reviews.

hfinkel added inline comments.Dec 10 2015, 10:35 AM
lib/Driver/Tools.cpp
1477 ↗(On Diff #41736)

Fair enough; Strahinja, please keep the braces :-)

This revision was automatically updated to reflect the committed changes.