-
Enhancement
-
Resolution: Unresolved
-
P4
-
21
Given this loop:
for (int i = 0; i < DST.length; i++) {
DST[i] = SRC1[i] + SRC2[DST.length - 1 - i];
}
C2 should be able to vectorize this loop by reversing the elements after loading from SRC2. Similarly, a reduction loop like this should also be vectorized:
int sum = 0;
for (int i = 0; i < DST.length; i++) {
sum += SRC1[i] + SRC2[DST.length - 1 - i];
}
for (int i = 0; i < DST.length; i++) {
DST[i] = SRC1[i] + SRC2[DST.length - 1 - i];
}
C2 should be able to vectorize this loop by reversing the elements after loading from SRC2. Similarly, a reduction loop like this should also be vectorized:
int sum = 0;
for (int i = 0; i < DST.length; i++) {
sum += SRC1[i] + SRC2[DST.length - 1 - i];
}
- relates to
-
JDK-8305707 SuperWord should vectorize reverse-order reduction loops
- Open