https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85694
Bug ID: 85694
Summary: Generation of vectorized AVG (Average) instruction
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
As mentioned in [1], page 12, following code:
--cut here--
#define N 1024
unsigned char src1[N], src2[N], dst[N];
void foo (void)
{
int i;
for (i = 0; i < N; i++)
dst[i] = (src1[i] + src2[i] + 1) >> 1;
}
--cut here--
should vectorize with pavgb instruction.
[1]
http://llvm.org/devmtg/2018-04/slides/Das-An%20Introduction%20to%20AMD%20Optimizing%20Compiler.pdf