Jeff Law wrote:

>> Btw reminds me a little bit of  
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28417

> I wouldn't expect 28417
> to move forward without something other than Tege and Denys pushing on it.

Hmm that doesn't look optimal. You can typically do a multiply with the magic
constant arranged in such a way that on 32-bit targets you don't need a shift 
at all.

There isn't much to the proof either, code like this is always self-proving: it 
tries
several possible magic constants until a solution is found that has no error 
for the
max input. Given there are usually several valid solutions, you can then select 
the
best shift/magic value combination.

Wilco

Reply via email to