===================================================================
@@ -3021,7 +3021,7 @@ (define_insn "*cond_<optab><mode>_4"
"TARGET_SVE"
"@
<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
- movprfx\t%0, %4\;<sve_fmad_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>"
+ movprfx\t%0, %4\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>"
[(set_attr "movprfx" "*,yes")]
)
===================================================================
@@ -0,0 +1,19 @@
+/* { dg-options "-O3" } */
+
+#include <stdint.h>
+
+#define N 55
+
+void __attribute__ ((noipa))
+f (double *restrict a, double *restrict b, double *restrict c,
+ double *restrict d, double *restrict e, int64_t *restrict cond)
+{
+ for (int i = 0; i < N; ++i)
+ {
+ a[i] = cond[i] ? __builtin_fma (c[i], d[i], e[i]) : e[i];
+ b[i] = cond[i] ? __builtin_fma (c[i], e[i], d[i]) : d[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {\tfmla\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
+/* { dg-final { scan-assembler-not {\tfmad\t} } } */
===================================================================
@@ -0,0 +1,28 @@
+/* { dg-do run { target aarch64_sve_hw } } */
+/* { dg-options "-O3" } */
+
+#include "fmla_2.c"
+
+int __attribute__ ((optimize (1)))
+main (void)
+{
+ double a[N], b[N], c[N], d[N], e[N];
+ int64_t cond[N];
+
+ for (int i = 0; i < N; ++i)
+ {
+ c[i] = i + i % 5;
+ d[i] = i + i % 7;
+ e[i] = i + i % 9;
+ cond[i] = i % 3;
+ }
+
+ f (a, b, c, d, e, cond);
+
+ for (int i = 0; i < N; ++i)
+ if (a[i] != (cond[i] ? __builtin_fma (c[i], d[i], e[i]) : e[i])
+ || b[i] != (cond[i] ? __builtin_fma (c[i], e[i], d[i]) : d[i]))
+ __builtin_abort ();
+
+ return 0;
+}