Bug#826987: gcc-6: __builtin_cpu_supports() doesn't work on powerpc
On Tue, Jul 05, 2016 at 08:31:24AM +0200, Mathieu Malaterre wrote:
> I cannot see the builtin mentionned anywhere other than on the X86 page:
>
> X86 (ok):
> https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/x86-Built-in-Functions.html#index-g_t_005f_005fbuiltin_005fcpu_005finit-4335
>
> PowerPC (nothing found):
> https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions
It's in the third dash point:
# — Built-in Function: int __builtin_cpu_supports (const char *feature)
#
# This function returns a value of 1 if the run-time CPU supports the
# HWCAP feature feature and returns 0 otherwise. The following features
# can be detected:
#
# ‘4xxmac’
# 4xx CPU has a Multiply Accumulator.
# ‘altivec’
# CPU has a SIMD/Vector Unit.
...
# ‘ppc32’
# CPU supports 32-bit mode execution.
> There is an equivalent issue with -march=native on PowerPC, which is
> also not mentioned (and does not work):
> https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
Programs that use detection specifically don't want -mfoo, as those options
either require or optimize for such a subtarget only. On the other hand,
using __builtin_cpu_supports() means you have two code paths, one optimized
for the given feature and one without.
> I suspect this is instead a minor formatting issue in the gcc
> documentation as shipped in Debian (could not double check):
> # reassign -1 gcc-6-doc
It's not only in the documentation (both on the webpage and gcc-6-doc), but
also in the code:
./gcc/config/rs6000/rs6000.c line 320 lists available arguments to
__builtin_cpu_supports().
./gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c runs it.
I'm afraid I'm terribad about debugging gcc, so I couldn't tell more.
At least, the amount of documentation for this and related functions is big
enough that it's something more than a "minor formatting issue". If indeed
this function is not supposed to be working in gcc-6, then it needs to be
clarified and removed from the documentation.
Should I try asking upstream?
Meow!
--
An imaginary friend squared is a real enemy.
Reply to: