Hi, all. Previously, Harmony Jira 5901 brought some benefits. Now I'm working on generalized multiplication replacement with shift and addition.
Today I checked with gcc and found whether a multiplication is replaced or not in gcc mainly (not strictly) depends on the number of the replaced operations. There are some exceptions in gcc and I couldn't summarize the rule without reading the source code. So I'm planning to round it to a simple decision as following: if it needs >=4 shift/add operations, don't do replacement; Otherwise, replace it with a combination of shift/add. For example x*20 (20=00010100) is replaced by (x<<2+x)<<2 and x*56 (56=00111000) is replaced by (x<<3-x)<<3 but x*29 (29=00011101) is not optimized by ((x<<3)-x)<<2+x. Any comments? Another question - may I read the source code of gcc since it is opensource in GPL? Thanks. Xiaoming
