https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85830
Bug ID: 85830 Summary: vec_popcntd is improperly defined in altivec.h Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: munroesj at gcc dot gnu.org Target Milestone: --- Created attachment 44147 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44147&action=edit compile test case for vec_popcntd. Altivec.h should define either the generic vec_popcnt or the specific vec_vpopcntd. In GCC-8.1 altivec.h defines the expected vec_popcnt (as defined in the ABI) and the PIM style specific vec_vpopcntd. these are OK. However it also defines vec_popcntd which generates __builtin_vec_vpopcntud. This gives compile errors. vector unsigned long long __test_popcntd_2 (vector unsigned long long a) { return (vec_popcntd (a)); } vector unsigned int __test_popcntw_2 (vector unsigned int a) { return (vec_popcntw (a)); } vec_popcnt-2.c: In function ‘__test_popcntd_2’: vec_popcnt-2.c:31:3: error: invalid parameter combination for AltiVec intrinsic ‘__builtin_vec_vpopcntud’ return (vec_popcntd (a)); ^~~~~~ vec_popcnt-2.c: In function ‘__test_popcntw_2’: vec_popcnt-2.c:37:3: error: invalid parameter combination for AltiVec intrinsic ‘__builtin_vec_vpopcntuw’ return (vec_popcntw (a)); ^~~~~~ There are two problems here; 1) You would expect a __builtin_vec_vpopcntud to accept a unsigned input and it does not. I am not sure what it does accept. 2) The vec_popcntd define fits neither the ABI generic specific (vec_popcnt()) or the old PIM specific style (vec_vpopcntd() which follows the PowerISA mnemonic. This 3rd style should be removed from altivec.h ( vec_popcntb, vec_popcnth, vec_popcntw, vec_popcntd) While retaining the ABI generic and PIM specific definitions.