This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

Summary

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.May 21 2020, 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 https://reviews.llvm.org/D80533
I will repurpose leave only the addition of the KF/KC modes in this patch.

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

Remove handling for explicit _Complex __float128.

rjmccall added inline comments.May 26 2020, 12:23 PM
clang/lib/Sema/SemaDeclAttr.cpp
3970

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.

3970

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

nemanjai updated this revision to Diff 266820.May 28 2020, 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.May 28 2020, 5:20 AM
nemanjai added inline comments.
clang/lib/Sema/SemaDeclAttr.cpp
3970

Very good point. Thank you. Added.

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

Thanks

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