[Bug tree-optimization/119181] Missed vectorization due to imperfect SLP discovery for strided & interleaved load.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119181
--- Comment #6 from Hongtao Liu ---
void
foo (int* a, int* __restrict b, int* c)
{
b[0] = a[0] * c[256];
b[1] = c[257] * a[1];
b[2] = a[2] * c[258];
b[3] = c[259] * a[3];
b[4] = c[260] * a[4];
b[5] = c[261] * a[5];
b[6] = a[6] * c[262];
b[7] = a[7] * c[263];
}
BB vectorizer will retrying with swapped operand if different interleaving
chains in one node.
/app/example.cpp:4:10: note: Build SLP for _1 = *a_26(D);
/app/example.cpp:4:10: note: Build SLP for _4 = MEM[(int *)c_27(D) + 1028B];
/app/example.cpp:4:10: missed: Build SLP failed: different interleaving
chains in one node _4 = MEM[(int *)c_27(D) + 1028B];
/app/example.cpp:4:10: note: Build SLP for _7 = MEM[(int *)a_26(D) + 8B];
/app/example.cpp:4:10: note: Build SLP for _10 = MEM[(int *)c_27(D) + 1036B];
/app/example.cpp:4:10: missed: Build SLP failed: different interleaving
chains in one node _10 = MEM[(int *)c_27(D) + 1036B];
/app/example.cpp:4:10: note: Build SLP for _13 = MEM[(int *)c_27(D) + 1040B];
/app/example.cpp:4:10: missed: Build SLP failed: different interleaving
chains in one node _13 = MEM[(int *)c_27(D) + 1040B];
/app/example.cpp:4:10: note: Build SLP for _16 = MEM[(int *)c_27(D) + 1044B];
/app/example.cpp:4:10: missed: Build SLP failed: different interleaving
chains in one node _16 = MEM[(int *)c_27(D) + 1044B];
/app/example.cpp:4:10: note: Build SLP for _19 = MEM[(int *)a_26(D) + 24B];
/app/example.cpp:4:10: note: Build SLP for _22 = MEM[(int *)a_26(D) + 28B];
/app/example.cpp:4:10: note: SLP discovery for node 0x10fbb9a0 failed
/app/example.cpp:4:10: note: Re-trying with swapped operands of stmts 1 3 4 5
/app/example.cpp:4:10: note: starting SLP discovery for node 0x10fbba30
/app/example.cpp:4:10: note: get vectype for scalar type (group size 8): int
/app/example.cpp:4:10: note: vectype: vector(8) int
/app/example.cpp:4:10: note: nunits = 8
/app/example.cpp:4:10: note: Build SLP for _1 = *a_26(D);
/app/example.cpp:4:10: note: Build SLP for _5 = MEM[(int *)a_26(D) + 4B];
/app/example.cpp:4:10: note: Build SLP for _7 = MEM[(int *)a_26(D) + 8B];
/app/example.cpp:4:10: note: Build SLP for _11 = MEM[(int *)a_26(D) + 12B];
/app/example.cpp:4:10: note: Build SLP for _14 = MEM[(int *)a_26(D) + 16B];
/app/example.cpp:4:10: note: Build SLP for _17 = MEM[(int *)a_26(D) + 20B];
/app/example.cpp:4:10: note: Build SLP for _19 = MEM[(int *)a_26(D) + 24B];
/app/example.cpp:4:10: note: Build SLP for _22 = MEM[(int *)a_26(D) + 28B];
/app/example.cpp:4:10: note: SLP discovery for node 0x10fbba30 succeeded
/app/example.cpp:4:10: note: starting SLP discovery for node 0x10fbbac0
/app/example.cpp:4:10: note: get vectype for scalar type (group size 8): int
/app/example.cpp:4:10: note: vectype: vector(8) int
[Bug tree-optimization/119181] Missed vectorization due to imperfect SLP discovery for strided & interleaved load.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119181
--- Comment #3 from Hongtao Liu ---
void
foo (int* a, int* __restrict b)
{
b[0] = a[0] * a[256];
b[1] = a[257] * a[1];
b[2] = a[2] * a[258];
b[3] = a[259] * a[3];
b[4] = a[260] * a[4];
b[5] = a[261] * a[5];
b[6] = a[6] * a[262];
b[7] = a[7] * a[263];
}
void
foo1 (int* a, int* __restrict b)
b[0] = a[0] * a[256];
b[1] = a[1] * a[257];
b[2] = a[2] * a[258];
b[3] = a[3] * a[259];
b[4] = a[4] * a[260];
b[5] = a[5] * a[261];
b[6] = a[6] * a[262];
b[7] = a[7] * a[263];
}
Use int instead of double.
Looks like if both operands satisfy same STMT_VINFO_GROUPED_ACCESS as first
stmt, we'd better have a heuristic to choose more closer one?
in vect_build_slp_tree_1
1360 || (ldst_p
1361 && (STMT_VINFO_GROUPED_ACCESS (stmt_info)
1362 != STMT_VINFO_GROUPED_ACCESS (first_stmt_info)))
1363 || (ldst_p
[Bug tree-optimization/119181] Missed vectorization due to imperfect SLP discovery for strided & interleaved load.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119181 --- Comment #5 from Hongtao Liu --- > > Looks like if both operands satisfy same STMT_VINFO_GROUPED_ACCESS as first > stmt, we'd better have a heuristic to choose more closer one? If all grouped operations satisfy commutative property.
[Bug tree-optimization/119181] Missed vectorization due to imperfect SLP discovery for strided & interleaved load.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119181 --- Comment #4 from Andrew Pinski --- (In reply to Hongtao Liu from comment #2) > (In reply to Andrew Pinski from comment #1) > > Looks like it is missing the commutativity property of multiply. > Note compiler options is with Ofast. What i mean is the commutative property is not being taken into account, that is the vectorizer misses the commutative property in some cases. PR 115833 is a similar case where the commutative property is not being taken into account.
[Bug tree-optimization/119181] Missed vectorization due to imperfect SLP discovery for strided & interleaved load.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119181 --- Comment #2 from Hongtao Liu --- (In reply to Andrew Pinski from comment #1) > Looks like it is missing the commutativity property of multiply. Note compiler options is with Ofast.
[Bug tree-optimization/119181] Missed vectorization due to imperfect SLP discovery for strided & interleaved load.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119181 --- Comment #1 from Andrew Pinski --- Looks like it is missing the commutativity property of multiply.
