On Wed, 2026-06-24 at 10:28 +0000, Eldar Osmanovic wrote:
> From: "dragan.mladjenovic" <[email protected]>
>
> This patch prevents middle-end from using MSA fma on pre-r6 targets
> in order to avoid subtle inconsistencies with auto-vectorized code that
> might mix MSA fma with unfused scalar multiply-add.
I don't think this is valid. The standard names fmaM4 and fnmaM4, and
the RTX code fma are defined as fused multiply-add. So using MSA for
them is always correct, regardless how the scalar instruction is
defined.
> diff --git a/gcc/testsuite/gcc.target/mips/msa-fuse-madd-double.c
> b/gcc/testsuite/gcc.target/mips/msa-fuse-madd-double.c
> new file mode 100644
> index 00000000000..e98bf017a6e
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/mips/msa-fuse-madd-double.c
> @@ -0,0 +1,52 @@
> +/* { dg-do run } */
> +/* { dg-options "-mhard-float -mmsa" } */
> +/* { dg-additional-options "-ffp-contract=fast" } */
-ffp-contract=fast explicitly allows the compiler to use fused FMA for a
seemingly unfused a * b + c. So if this is what you are attempting to
fix, you should simply compile the program with -ffp-contract=off,
instead of blocking optimizations perfectly valid with -ffp-
contract=fast.
--
Xi Ruoyao <[email protected]>