https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
Bug ID: 101985 Summary: vec_cpsgn parameter order Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: simb611alt at gmail dot com Target Milestone: --- I have found an issue where the parameter order of the vec_cpsgn function on POWER is reversed. Clang has recently fixed the same issue in their code which leaves only GCC using the reversed order. XLC always used the order clang currently uses. Patch link for clang - https://github.com/llvm/llvm-project/commit/1af037f643fc5499f83d92e5aec199950871d475 Link to POWER documentation - http://cdn.openpowerfoundation.org/wp-content/uploads/resources/Intrinsics-Reference/content/VIPR.reference.vecfns.html #include <stdio.h> #include <altivec.h> int main() { vector float a = { 1, 2, - 3, - 4}; vector float b = {-10, 20, -30, 40}; a = vec_cpsgn(a, b); printf("%f %f %f %f\n", a[0], a[1], a[2], a[3]); return 0; } Output for GCC 11.0.1: -1.000000 2.000000 -3.000000 4.000000 Output for clang 12.0.1: 10.000000 20.000000 -30.000000 -40.000000 Output for xlc 16.1.1: 10.000000 20.000000 -30.000000 -40.000000