|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
From Paul:
We have been investigating range check issues when using the Vector API. The recommended approach for loops is to express the upper bound using the method VectorSpecies.loopBound as in say:
@Benchmark
public float[] vector1() {
int i = 0;
for (; i < SPECIES.loopBound(a.length); i += SPECIES.length()) {
// FloatVector va, vb, vc;
var va = FloatVector.fromArray(SPECIES, a, i);
var vb = FloatVector.fromArray(SPECIES, b, i);
var vc = va.fma(va, vb.mul(vb)).neg();
vc.intoArray(r, i);
}
for (; i < a.length; i++) {
r[i] = Math.fma(a[i], a[i], b[i] * b[i]) * -1.0f;
}
return r;
}
However, this does not result in the removal of bounds checks from within the loop when loading/storing the vectors from/to memory.
|