https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129007
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Igor Shevlyakov <[email protected]>: https://gcc.gnu.org/g:7543d3c4c4a4630709a002a3cf012c0512dc8eb6 commit r17-6670-g7543d3c4c4a4630709a002a3cf012c0512dc8eb6 Author: Igor Shevlyakov <[email protected]> Date: Tue Nov 24 13:07:43 2026 -0800 vect: Fix the operands of the complex FMS pattern [PR129007] r16-4663-gc5fa3d4c88fc4f made vect_validate_multiplication return its operands in a flat vector RES_OPS = { L0, L1, R0, R1 }. complex_fms_pattern::matches calls it with the operands swapped, (RIGHT_OP, LEFT_OP), so the caller's RIGHT_OP is RES_OPS[0..1] and its LEFT_OP RES_OPS[2..3], but the code after the call reads them the other way round. For for (int i = 0; i < n; i++) c[i * s] -= x[i] * y[i]; with -O2 -ffast-math -march=armv8.3-a the loaded x[i] and y[i] then go into FCMLA with the imaginary part broadcast to both lanes, and the result is wrong. Use the same indices as the PLUS_MINUS form of the pattern earlier in the function, which makes the same call. Assisted-by: Claude Opus 5.5 PR tree-optimization/129007 gcc/ChangeLog: * tree-vect-slp-patterns.cc (complex_fms_pattern::matches): Take the operands of the multiplication from the right elements of res_ops. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr129007.c: New test. * gcc.target/aarch64/pr129007-1.c: New test. * gcc.target/aarch64/pr129007-2.c: New test. Signed-off-by: Igor Shevlyakov <[email protected]>
