http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60656
Cong Hou <congh at google dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |congh at google dot com --- Comment #2 from Cong Hou <congh at google dot com> --- This bug is caused by an optimization in GCC vectorizer that is not implemented properly. When a reduction operation is vectorized, the order of elements in vectors directly used in reduction does not matter. In some cases the vectorizer may generate less code based on this fact. GCC assigns a property named "vect_used_by_reduction" to all vectors participating in reductions. However, vectors that are indirectly used in reduction also have this property. For example, consider the following three statements (all operands are vectors): a = b op1 c; d = a op2 e; s1 = s0 op3 d; Here assume the last statement is a reduction one, then a,b,c,d,e all have the property "vect_used_by_reduction". However, if op2 is different from op3, then a's element order can affect the final result. GCC does not check this.