Skip to content

clang 16/17/18 fail to compiler ppc64le with -mfloat128 #136044

@munroesj52

Description

@munroesj52

Clang fails the pveclib configure test for PVECLIB_FLOAT128_CFLAGS with -mfloat128. and no -mcpu. This should default to power8 and the libgcc runtime.

Clang uses /usr/include/powerpc64le-linux-gnu/bits/floatn.h from the GCC installation which defines:

/* The following builtins (suffixed with 'q') are available in GCC >= 6.2,
   which is the minimum version required for float128 support on powerpc64le.
   Since GCC 7.0 the builtins suffixed with f128 are also available, then
   there is no need to redefined them.  */
#  if !__GNUC_PREREQ (7, 0)
#   define __builtin_copysignf128 __builtin_copysignq
#   define __builtin_fabsf128 __builtin_fabsq
#   define __builtin_inff128 __builtin_infq
#   define __builtin_nanf128 __builtin_nanq
#   define __builtin_nansf128 __builtin_nansq
#  endif

But the configure test fails with:

conftest.c:78:13: error: use of unknown builtin '__builtin_copysignq' [-Wimplicit-function-declaration]
   78 |     return (__builtin_copysignf128(valx, valy));
      |             ^
/usr/include/powerpc64le-linux-gnu/bits/floatn.h:101:35: note: expanded from macro '__builtin_copysignf128'
  101 | #   define __builtin_copysignf128 __builtin_copysignq
      |                                   ^
1 error generated.

GCC still defines both __builtin_copysignf128 and __builtin_copysignq

But is appears that clang only defines __builtin_copysignf128 which leaves GCCs floatn.h in a confused state.

PVECLIB is @ https://github.com/open-power-sdk/pveclib
The pveclib configue test source is ./testprograms/test_ppc_F128.c

Metadata

Metadata

Assignees

No one assigned

    Labels

    clangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions