This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] [Clang] Define macros to identify quad-fp semantics
ClosedPublic

Authored by qiucf on Oct 26 2020, 9:42 PM.

Details

Summary

We have option -mabi=ieeelongdouble to set current long double to IEEEquad semantics. Like what GCC does, we need to define __LONG_DOUBLE_IEEE128__ macro in this case, and __LONG_DOUBLE_IBM128__ if using PPCDoubleDouble.

Diff Detail

Event Timeline

qiucf created this revision.Oct 26 2020, 9:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2020, 9:42 PM
qiucf requested review of this revision.Oct 26 2020, 9:42 PM
qiucf updated this revision to Diff 300887.

Remove FIXME

steven.zhang accepted this revision.Nov 1 2020, 6:37 PM
steven.zhang added inline comments.
clang/lib/Basic/Targets/PPC.cpp
123

Can you please double check if we need to define these two macros if PPC IEEE long double enabled ? And also double check if they can be controlled by options.

This revision is now accepted and ready to land.Nov 1 2020, 6:37 PM

Sorry, accept the revision by mistake. Please hold on until my comments addressed.

qiucf added inline comments.Nov 3 2020, 12:32 AM
clang/lib/Basic/Targets/PPC.cpp
123

Yes. GCC shows expected behavior that __LONG_DOUBLE_IEEE128__ is defined under -mabi=ieeelongdouble while __LONG_DOUBLE_IBM128__ is defined when not. Some libraries may rely on this macro. (see https://www.openwall.com/lists/musl/2019/06/30/8)

In clang, currently we can only use __LDBL_MANT_DIG__ to guess current 128-bit fp semantics. (106 for IBM-quad, 113 for IEEE-quad). We need to implement dedicated macros.

And I'll keep the FIXME since it's not related to this revision.

qiucf updated this revision to Diff 302488.Nov 3 2020, 12:35 AM
qiucf marked an inline comment as done.

Keep the FIXME.

LGTM now and thank you for the double check. But please hold on for some days in case someone has concern on enabling the new macros(we are enabling the LONG_DOUBLE_IBM128 by default now).