search for: strength_reduct

Displaying 1 result from an estimated 1 matches for "strength_reduct".

2016 Jan 04
2
Fwd: Strength reduction in loops
...a simple loop: long foo(int len, long* s) { long sum = 0; for (int i=0; i<len; i++) sum += s[i*12]; return sum; } There is a multiplication in each loop iteration. Can this be turned into addition, and is there already a pass that does? (https://en.wikipedia.org/wiki/Strength_reduction uses this very situation as an example in the opening paragraph: "In software engineering, strength reduction is a compiler optimization where expensive operations are replaced with equivalent but less expensive operations. The classic example of strength reduction converts "strong&qu...