Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLANG specific issues. #94

Open
munroesj52 opened this issue May 11, 2020 · 5 comments
Open

CLANG specific issues. #94

munroesj52 opened this issue May 11, 2020 · 5 comments

Comments

@munroesj52
Copy link
Contributor

munroesj52 commented May 11, 2020

  • Can not tell what is up with Float128 support. FLOAT128 is not defined.
    • ./pveclib/vec_f128_ppc.h:209:17: error: cannot combine with previous declaration specifier
    • typedef vf128_t __float128;
    • Clang claims to support __float128 but may require explicit -mfloat128 for use.
      • Clang seems to require both -mcpu=power9 and -mfloat128 for clang-8
      • This defines FLOAT128 and enables the __float128 type
      • Otherwise you are not allowed to use or redefine (typedef) __float128
    • But Clang (attempts) to use the GCC/GLIBC installed math.h, stdlib.h ... headers which will get compile errors if -mcpu=power9 -mfloat128 is enabled.
      • Basically clang chokes on code in bits/floatn.h what uses attribute ((mode (KC)))
  • Seems to be still using long double == _IBM128 but the type constrains do not seem to be working.
  • No Decimal FP support. Had to disable BCD.
    • Can't even use in-line asm because clang does no recognize the constraints for FPR pairs (FPRp) required for _Decimal128.
  • No constant folding for __int128 for example:
    • (__int128 ) 10ll * (__int128 ) 1000000000000000000ll, /* 10**19 */
    • works on GCC for both scalar and vector initializers.
  • No support for vector bool _int128. GCC supports.
  • Does not support #pagma GCC target
  • vec_ld () does not handle vector __int128 (as specified in the Power Vector Intrinsic Programming Reference). CLang only supports the original VMX types. GCC support vector __int128 and long long.
  • Clang does not support __builtin_unpack_longdouble, should be a direct register transfer.
    • Again can't use in-line asm because clang does not support the FPR pair constaints
  • Code gen bug in clang8 for vec_sra vector long long.
  • Clang8 for -mcpu=power9 does not support inline asm for vmsumud which is a valid instruction and mnemonic. This cripples the implementation of quadword and multi-quadword precision multiply.
  • Before clang 9 clang miss assembled the DCMX of the Test Data Class instructions.
@munroesj52
Copy link
Contributor Author

Clang can also be more picky about pointer types in ASM "m" and "Z" constraints. GCC does not care as long as it can see the EA calculation. For example:

"=Z" (*((char *)rb+rt))

Is OK for GCC, but will generate a char storage copy for Clang. Clang seems to need pointer type like:

"=Z" ((double)((char *)rb+rt))

@ecnelises
Copy link

Clang 14 (next major release, estimated to be available early next year) will support:

  • __ibm128 type for traditional double-double format on Power
  • mode(IF)/mode(IC) for forced double-double format
  • -mfloat128 will be enabled by default for VSX targets (Power7 and later)
  • long double may switch to __float128 as default semantics, and there seems to be similar changes in GCC
    • In clang 9 and later, -mabi=ieeelongdouble/ibmlongdouble is available to switch long double semantics, so we cannot expect long double is __ibm128
    • Use __LONG_DOUBLE_IEEE128__ and __LONG_DOUBLE_IBM128__ to tell current long double semantics (available since clang 12)

@munroesj52
Copy link
Contributor Author

munroesj52 commented Oct 12, 2021 via email

@munroesj52
Copy link
Contributor Author

munroesj52 commented Nov 26, 2021 via email

@ecnelises
Copy link

So it looks like Clang 12 with -mfloat128 will define FLOAT128 but will
not let you define or use __float128 or __ieee128.

Clang doesn't have __ieee128, but __float128 (and 'q/Q' as constant suffix) is available under -mfloat128 -mcpu=power9.

Does _Float128 work as a type in C?

Currently not. There is patching adding this (https://reviews.llvm.org/D111382) while some reviewers are against it (making difference between C and C++).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants