Mettle

int32-sum-narrow-accint32 sum into an accumulator narrower than int64

Reported by --explain after a verdict.

mettle explain int32-sum-narrow-acc

Same rule as byte-sum-narrow-acc, one width up. The int32 sum kernel (vpaddd) folds eight lanes into an int64 accumulator, because eight int32 values summed can overflow int32 while the scalar loop, adding one at a time, would not have.

Fix: declare the accumulator int64. The elements stay int32; only the running total widens.

Related