https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122601
--- Comment #6 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:e61df21035e98c92d6d277e00df81d4168ffe8d1 commit r17-6624-ge61df21035e98c92d6d277e00df81d4168ffe8d1 Author: Igor Shevlyakov <[email protected]> Date: Mon Nov 23 15:29:30 2026 -0800 doc: Fix the semantics of cmls and cmls_conj [PR122601] The documentation of the cmls<mode>4 and cmls_conj<mode>4 optabs says they compute op1 * op2 - op3 (resp. op1 * conj (op2) - op3), but the vectorizer's complex_fms_pattern forms IFN_COMPLEX_FMS and IFN_COMPLEX_FMS_CONJ from c - a * b, and the aarch64 (Advanced SIMD, SVE, SVE2) and arm (Neon, MVE) expanders implement exactly that: the product is subtracted from the accumulator. A port written to the documentation miscompiles, e.g. fma180 in gcc.dg/vect/complex/vect-complex-operations-run.c. Fix the documentation to match the implementation. One in-tree port does follow the old documentation: the amdgcn cmls<mode>4 expander in gcn-valu.md computes op1 * op2 - op3 (it starts from fms<mode>4), so the vectorized loops it is used for get the wrong sign. The run test above does not catch this because vect_complex_add_double is only true for arm and aarch64. That is a code bug in the port and will be handled separately. Assisted-by: Claude Opus 5.5 PR other/122601 gcc/ChangeLog: * doc/md.texi (cmls@var{m}4, cmls_conj@var{m}4): Document that the product is subtracted from operand 3. Signed-off-by: Igor Shevlyakov <[email protected]>
