https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121375
Bug ID: 121375 Summary: Altivec intrinsic vec_rlmi generates incorrect code. Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: munroesj at gcc dot gnu.org Target Milestone: --- When compiling for -mcpu=power9 and intrinsic vec_rlmi the generated vrlwmi swaps the 1st/2nd operands. For example: vui32_t test_vec_rlmi (vui32_t a, vui32_t b, vui32_t c) { vui32_t result; #ifdef _ARCH_PWR9 #if defined (vec_rlmi) result = vec_rlmi (a, b, c); #endif #endif return ((vui32_t) result); } Would expect: 0000000000000000 <test_vec_rlmi>: 0: 85 20 43 10 vrlwmi v2,v3,v4 4: 20 00 80 4e blr This is true for GCC versions 6-10. But for more recent GCC versions (11-14) I see: 0000000000000000 <test_vec_rlmi>: 0: 85 20 62 10 vrlwmi v3,v2,v4 4: 97 1c 43 f0 xxmr vs34,vs35 8: 20 00 80 4e blr And the results are incorrect for Vector Rotate Left then Mask-Insert operation.