https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95839
Bug ID: 95839
Summary: Failure to optimize addition of vector elements to
vector addition
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
typedef float __attribute__((vector_size(8))) v2f32;
v2f32 f(v2f32 a, v2f32 b)
{
return (v2f32){a[0] + b[0], a[1] + b[1]};
}
This can be optimized to `return a + b;`. This transformation is done by LLVM,
but not by GCC.