https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71777
Bug ID: 71777 Summary: __builtin_cpu_supports() doesn't work on powerpc Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mathieu.malaterre at gmail dot com Target Milestone: --- Created attachment 38839 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38839&action=edit demo code I've been trying to test __builtin_cpu_supports on PowerPC (ppc32 and ppc64), as per documentation: https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions However the attached code never returns a value of 1, 0 is always returned. No warning/errors were shown when compiling it with: % gcc-6 -O3 -m32 -o cpu32 cpu.c && ./cpu32 or % gcc-6 -O3 -m64 -o cpu64 cpu.c && ./cpu64 ref: % gcc-6 --version gcc-6 (Debian 6.1.1-8) 6.1.1 20160630 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. malat@pizzetti ~ % cat /proc/cpuinfo processor : 0 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 1 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 2 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) processor : 3 cpu : POWER8E (raw), altivec supported clock : 3425.000000MHz revision : 2.1 (pvr 004b 0201) timebase : 512000000 platform : pSeries model : IBM pSeries (emulated by qemu) machine : CHRP IBM pSeries (emulated by qemu) as well as: malat@partch ~ % cat /proc/cpuinfo processor : 0 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 1 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 2 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 3 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 4 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 5 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 6 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) processor : 7 cpu : POWER7 (architected), altivec supported clock : 3550.000000MHz revision : 2.1 (pvr 003f 0201) timebase : 512000000 platform : pSeries model : IBM,8231-E2B machine : CHRP IBM,8231-E2B