Skip to content

Commit b96e2b7

Browse files
committed
clarify details of code example
1 parent 8709d8c commit b96e2b7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

text/3838-scalable-vectors.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,16 @@ fn sve_add(in_a: Vec<f32>, in_b: Vec<f32>, out_c: &mut Vec<f32>) {
101101
let c = out_c as *mut f32;
102102
let c = c.add(i);
103103

104-
// `svwhilelt_b32` generates a mask based on comparing the current
105-
// index against the `len`
104+
// `svwhilelt_b32` generates a predicate vector that deals with
105+
// the tail of the iteration - it enables the operations which
106+
// follow for the first `len` elements overall, but disables
107+
// the last `len % step` elements in the last iteration
106108
let pred = svwhilelt_b32(i as _, len as _);
107109

108110
// `svld1_f32` loads a vector register with the data from address
109111
// `a`, zeroing any elements in the vector that are masked out
112+
//
113+
// Does not access memory for inactive elements
110114
let sva = svld1_f32(pred, a);
111115
let svb = svld1_f32(pred, b);
112116

0 commit comments

Comments
 (0)