middle-end: Handle FMA_CONJ correctly after SLP layout update.
Apologies, I got dinged by the i386 regressions bot for a test I didn't have in my tree at the time I made the previous patch. The bot was telling me that FMA stopped working after I strengthened the FMA check in the previous patch. The reason is that the check is slightly early. The first check can indeed only exit early when either node isn't a mult. However we need to delay till we know if the node is a MUL or FMA before enforcing that both nodes must be a MULT since the node to inspect is different if the operation is a MUL or FMA. Also with the update patch for GCC 11 tree layout update to the new GCC 12 one I had missed that the difference in which node is conjucated is not symmetrical. So the test for it can just be testing the inverse order. It was Currently no detecting when the first node was conjucated instead of the second one. This also made me wonder why my own test didn't detect this. It turns out that the tests, being copied from the _Float16 ones were incorrectly marked as xfail. The _Float16 ones are marked as xfail since C doesn't have a conj operation for _Float16, which means you get extra type-casts in between. While you could use the GCC _Complex extension here I opted to mark them xfail since I wanted to include detection over the widenings next year. Secondly the double tests were being skipped because Adv. SIMD was missing from targets supporting Complex Double vectorization. With these changes all other tests run and pass and only XFAIL ones are correctly the _Float16 ones. Sorry for missing this before, testing should now cover all cases. gcc/ChangeLog: PR tree-optimization/103311 PR target/103330 * tree-vect-slp-patterns.c (vect_validate_multiplication): Fix CONJ test to new codegen. (complex_mul_pattern::matches): Move check downwards. gcc/testsuite/ChangeLog: PR tree-optimization/103311 PR target/103330 * gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-double.c: Fix it. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-float.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-double.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-float.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-double.c: Likewise. * gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c: Likewise. * lib/target-supports.exp (check_effective_target_vect_complex_add_double): Add Adv. SIMD.
This commit is contained in:
parent
79e9f721d1
commit
487d604b6f
8 changed files with 37 additions and 26 deletions
|
@ -1,10 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target vect_complex_add_double } */
|
||||
/* { dg-add-options arm_v8_3a_complex_neon } */
|
||||
/* { dg-additional-options "-fdump-tree-vect-details" } */
|
||||
|
||||
#define TYPE double
|
||||
#define N 16
|
||||
#include "complex-mla-template.c"
|
||||
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA_CONJ" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA_CONJ" "vect" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA" "vect" } } */
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target vect_complex_add_float } */
|
||||
/* { dg-additional-options "-fno-tree-loop-vectorize" } */
|
||||
/* { dg-additional-options "-fdump-tree-vect-details" } */
|
||||
/* { dg-add-options arm_v8_3a_fp16_complex_neon } */
|
||||
|
||||
#define TYPE float
|
||||
#define N 16
|
||||
#include "complex-mla-template.c"
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA_CONJ" "slp1" { xfail *-*-* } } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA" "slp1" { xfail *-*-* } } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA_CONJ" "vect" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA" "vect" } } */
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target vect_complex_add_double } */
|
||||
/* { dg-add-options arm_v8_3a_complex_neon } */
|
||||
/* { dg-additional-options "-fdump-tree-vect-details" } */
|
||||
|
||||
#define TYPE double
|
||||
#define N 16
|
||||
#include "complex-mls-template.c"
|
||||
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMA" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS_CONJ" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS_CONJ" "vect" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "vect" } } */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target vect_complex_add_float } */
|
||||
/* { dg-additional-options "-fno-tree-loop-vectorize" } */
|
||||
/* { dg-additional-options "-fdump-tree-vect-details" } */
|
||||
/* { dg-add-options arm_v8_3a_complex_neon } */
|
||||
|
||||
#define TYPE float
|
||||
#define N 16
|
||||
#include "complex-mls-template.c"
|
||||
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS_CONJ" "slp1" { xfail *-*-* } } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "slp1" { xfail *-*-* } } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS_CONJ" "vect" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_FMS" "vect" } } */
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target vect_complex_add_double } */
|
||||
/* { dg-add-options arm_v8_3a_complex_neon } */
|
||||
/* { dg-additional-options "-fdump-tree-vect-details" } */
|
||||
|
||||
#define TYPE double
|
||||
#define N 16
|
||||
#include "complex-mul-template.c"
|
||||
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL_CONJ" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL_CONJ" "vect" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "vect" } } */
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
#define N 16
|
||||
#include "complex-mul-template.c"
|
||||
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL_CONJ" "slp1" { xfail *-*-* } } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "slp1" { xfail *-*-* } } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL_CONJ" "slp1" } } */
|
||||
/* { dg-final { scan-tree-dump "Found COMPLEX_MUL" "slp1" } } */
|
||||
|
|
|
@ -3632,8 +3632,10 @@ proc check_effective_target_vect_complex_add_float { } {
|
|||
proc check_effective_target_vect_complex_add_double { } {
|
||||
return [check_cached_effective_target_indexed vect_complex_add_double {
|
||||
expr {
|
||||
([check_effective_target_aarch64_sve2]
|
||||
&& [check_effective_target_aarch64_little_endian])
|
||||
(([check_effective_target_arm_v8_3a_complex_neon_ok]
|
||||
&& [check_effective_target_aarch64_little_endian])
|
||||
|| ([check_effective_target_aarch64_sve2]
|
||||
&& [check_effective_target_aarch64_little_endian]))
|
||||
}}]
|
||||
}
|
||||
|
||||
|
|
|
@ -809,14 +809,20 @@ vect_validate_multiplication (slp_tree_to_load_perm_map_t *perm_cache,
|
|||
if (linear_loads_p (perm_cache, left_op[index2]) == PERM_EVENODD)
|
||||
return true;
|
||||
}
|
||||
else if (kind == PERM_EVENODD)
|
||||
else if (kind == PERM_EVENODD && !neg_first)
|
||||
{
|
||||
if ((kind = linear_loads_p (perm_cache, left_op[index2])) == PERM_EVENODD)
|
||||
if ((kind = linear_loads_p (perm_cache, left_op[index2])) != PERM_EVENEVEN)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if (!neg_first)
|
||||
*conj_first_operand = true;
|
||||
else if (kind == PERM_EVENEVEN && neg_first)
|
||||
{
|
||||
if ((kind = linear_loads_p (perm_cache, left_op[index2])) != PERM_EVENODD)
|
||||
return false;
|
||||
|
||||
*conj_first_operand = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
|
@ -949,7 +955,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. */
|
||||
|
@ -962,7 +968,7 @@ complex_mul_pattern::matches (complex_operation_t op,
|
|||
{
|
||||
auto vals = SLP_TREE_CHILDREN (l0node[0]);
|
||||
/* Check if it's a multiply, otherwise no idea what this is. */
|
||||
if (!vect_match_expression_p (vals[1], MULT_EXPR))
|
||||
if (!(mul0 = vect_match_expression_p (vals[1], MULT_EXPR)))
|
||||
return IFN_LAST;
|
||||
|
||||
/* Check if the ADD is linear, otherwise it's not valid complex FMA. */
|
||||
|
@ -979,6 +985,8 @@ complex_mul_pattern::matches (complex_operation_t op,
|
|||
|
||||
if (left_op.length () != 2
|
||||
|| right_op.length () != 2
|
||||
|| !mul0
|
||||
|| !mul1
|
||||
|| linear_loads_p (perm_cache, left_op[1]) == PERM_ODDEVEN)
|
||||
return IFN_LAST;
|
||||
|
||||
|
@ -993,7 +1001,7 @@ complex_mul_pattern::matches (complex_operation_t op,
|
|||
if (!vect_validate_multiplication (perm_cache, left_op, PERM_EVENEVEN)
|
||||
|| vect_normalize_conj_loc (left_op))
|
||||
return IFN_LAST;
|
||||
if (!mul0)
|
||||
if (add0)
|
||||
ifn = IFN_COMPLEX_FMA;
|
||||
else
|
||||
ifn = IFN_COMPLEX_MUL;
|
||||
|
@ -1005,7 +1013,7 @@ complex_mul_pattern::matches (complex_operation_t op,
|
|||
false))
|
||||
return IFN_LAST;
|
||||
|
||||
if(!mul0)
|
||||
if(add0)
|
||||
ifn = IFN_COMPLEX_FMA_CONJ;
|
||||
else
|
||||
ifn = IFN_COMPLEX_MUL_CONJ;
|
||||
|
|
Loading…
Add table
Reference in a new issue