This is an archive of the discontinued LLVM Phabricator instance.

[CMake] [Clang] Add CMake build option to specify long double format on PowerPC
ClosedPublic

Authored by qiucf on Jan 25 2022, 1:22 AM.

Details

Summary

This method introduces new CMake variable PPC_LINUX_DEFAULT_IEEELONGDOUBLE (false by default) to enable fp128 as default long double format.

We need to make some tests explicitly set long double type, otherwise they fail in either config.

Diff Detail

Event Timeline

qiucf created this revision.Jan 25 2022, 1:22 AM
qiucf requested review of this revision.Jan 25 2022, 1:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2022, 1:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

It is probably not worth the effort since there won't be that many test cases that test the front end's IR generation for long double, but there should be a way to set up lit to know the default through its configuration files.

nemanjai added inline comments.Jan 25 2022, 6:53 AM
clang/CMakeLists.txt
240

Do we need any error checking here? What happens if someone erroneously sets this on an AIX build (or big endian Linux, FreeBSD, etc.)?

jsji added a comment.Jan 25 2022, 8:39 AM

It is probably not worth the effort since there won't be that many test cases that test the front end's IR generation for long double, but there should be a way to set up lit to know the default through its configuration files.

Yes, that is not a must for now, but we should try to do it .

There's one thing uncertain: whether this config only applies to ppc64le?

Let us apply it to ppc64le only for now.

clang/CMakeLists.txt
240

How about CLANG_DEFAULT_IEEELONGDOUBLE_ON_PPC_LINUX similar to CLANG_DEFAULT_PIE_ON_LINUX?

clang/include/clang/Driver/ToolChain.h
413

defaultToIEEELongDouble?

clang/lib/Driver/ToolChain.cpp
113

Check OS here ?

eg: CLANG_DEFAULT_IEEELONGDOUBLE_ON_PPC_LINUX && OS.Linux()

qiucf updated this revision to Diff 403114.Jan 25 2022, 7:31 PM
qiucf marked 3 inline comments as done.
qiucf edited the summary of this revision. (Show Details)
qiucf added a comment.Jan 25 2022, 7:35 PM

It is probably not worth the effort since there won't be that many test cases that test the front end's IR generation for long double, but there should be a way to set up lit to know the default through its configuration files.

Yes, lit doesn't know about it. But lit can't do things in IR test like #ifdef in C nor change default semantics of clang, so it seems not able to help in such cases.

jsji accepted this revision as: jsji.Jan 26 2022, 5:28 AM

LGTM.

This revision is now accepted and ready to land.Jan 26 2022, 5:28 AM
This revision was landed with ongoing or failed builds.Jan 26 2022, 8:53 AM
This revision was automatically updated to reflect the committed changes.