--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-O2 -march=armv9-a -msve-vector-bits=256 -fdump-tree-widening_mul" } */
+
+typedef __attribute__((__vector_size__(sizeof(int)*8))) signed int v8i;
+typedef __attribute__((__vector_size__(sizeof(int)*8))) unsigned int v8u;
+void f(v8i *a,v8i *b,v8u *c)
+{
+ *c = (v8u)(*a * *b) - *c;
+}
+
+void g(v8i *a,v8i *b,v8u *c)
+{
+ *c = *c - (v8u)(*a * *b);
+}
+
+/* { dg-final { scan-tree-dump-times "\.FMA" 2 "widening_mul" } } */
static void
convert_mult_to_fma_1 (tree mul_result, tree op1, tree op2)
{
- tree type = TREE_TYPE (mul_result);
gimple *use_stmt;
imm_use_iterator imm_iter;
gcall *fma_stmt;
{
if (ops[0] == result)
/* a * b - c -> a * b + (-c) */
- addop = gimple_build (&seq, NEGATE_EXPR, type, addop);
+ addop = gimple_build (&seq, NEGATE_EXPR, TREE_TYPE (addop), addop);
else
/* a - b * c -> (-b) * c + a */
negate_p = !negate_p;
}
if (negate_p)
- mulop1 = gimple_build (&seq, NEGATE_EXPR, type, mulop1);
+ mulop1 = gimple_build (&seq, NEGATE_EXPR, TREE_TYPE (mulop1), mulop1);
if (seq)
gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);