<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/136044>136044</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang 16/17/18 fail to compiler ppc64le with -mfloat128
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          munroesj52
      </td>
    </tr>
</table>

<pre>
    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

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVU1z2zYQ_TXQZUccEqRE6sADrZiZznjaNHHbowYElyISEKDxIdv_vgNQclr54xAfbAs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