middle-end: check that both sides of complex expression is a mul.

Both sides of the VEC_PERM_EXPR need to be a MULT but the check
was accidentally checking if both sides are a mul.

The FMS case would be handled by the validate_multiplication but
this makes the requirement more explicit and we exit earlier.

gcc/ChangeLog:

	PR tree-optimization/103311
	* tree-vect-slp-patterns.c (complex_mul_pattern::matches,
	complex_fms_pattern::matches): Check for multiplications.

gcc/testsuite/ChangeLog:

	PR tree-optimization/103311
	* gcc.target/aarch64/pr103311.c: New test.
This commit is contained in:
Tamar Christina 2021-11-18 17:10:36 +00:00
parent 2196a681d7
commit 4f0a2f5a3d
2 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,16 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_v8_3a_complex_neon_ok } */
/* { dg-add-options arm_v8_3a_complex_neon } */
/* { dg-additional-options "-std=c99" } */
_Complex double y;
void
cbknu (_Complex double f)
{
const _Complex double cone = 1.0e0;
f = f * cone;
y = f * cone;
}

View File

@ -949,7 +949,7 @@ complex_mul_pattern::matches (complex_operation_t op,
bool mul0 = vect_match_expression_p (l0node[0], MULT_EXPR);
bool mul1 = vect_match_expression_p (l0node[1], MULT_EXPR);
if (!mul0 && !mul1)
if (!mul0 || !mul1)
return IFN_LAST;
/* Now operand2+4 may lead to another expression. */
@ -1204,7 +1204,9 @@ complex_fms_pattern::matches (complex_operation_t op,
/* If these nodes don't have any children then they're
not ones we're interested in. */
if (left_op.length () != 2 || right_op.length () != 2)
if (left_op.length () != 2
|| right_op.length () != 2
|| !vect_match_expression_p (l0node[1], MULT_EXPR))
return IFN_LAST;
bool is_neg = vect_normalize_conj_loc (left_op);