Page MenuHomePhabricator

[Clang] Enable KF and KC mode for [_Complex] __float128

Authored by nemanjai on Thu, May 21, 4:32 AM.



The headers provided with recent GNU toolchains for PPC have code that includes typedefs such as:
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__)))

Also, when I added __float128, I neglected to add support for _Complex __float128 altogether. This patch fixes those oversights and allows clang to compile something like:

#include <math.h>
_Complex __float128 testkf(_Complex __float128 a, _Complex __float128 b) {
  return a + b;

with -mfloat128 which it currently fails to compile due to the two reasons listed above.

Diff Detail

Event Timeline

nemanjai created this revision.Thu, May 21, 4:32 AM
Herald added a project: Restricted Project. · View Herald Transcript

Would you mind separating these two patches? They don't seem have any interdependencies.

The support for _Complex __float128 in
I will repurpose leave only the addition of the KF/KC modes in this patch.

nemanjai updated this revision to Diff 266092.Mon, May 25, 5:42 PM

Remove handling for explicit _Complex __float128.

rjmccall added inline comments.Tue, May 26, 12:23 PM

Are there interactions with the other mode specifiers? For example, should this be allowed with integer modes? If so, I think this needs more tests.


I shouldn't have said "if so" — *either way*, this needs more tests.

nemanjai updated this revision to Diff 266820.Thu, May 28, 5:19 AM

Handled invalid uses of KI as there is no corresponding integer mode and added testing for it.

nemanjai marked 3 inline comments as done.Thu, May 28, 5:20 AM
nemanjai added inline comments.

Very good point. Thank you. Added.

rjmccall accepted this revision.Thu, May 28, 10:45 AM


This revision is now accepted and ready to land.Thu, May 28, 10:45 AM
This revision was automatically updated to reflect the committed changes.
nemanjai marked an inline comment as done.