On Fri, Sep 21, 2012 at 10:04 AM, Christophe Lyon <christophe.l...@linaro.org> wrote: > On 20 September 2012 09:55, Christophe Lyon <christophe.l...@linaro.org> > wrote: >> On 20 September 2012 09:12, Eric Botcazou <ebotca...@adacore.com> wrote: >>>> The attached patch catches C constructs: >>>> (A << 8) | (A >> 8) >>>> where A is unsigned 16 bits >>>> and maps them to builtin_bswap16(A) which can provide more efficient >>>> implementations on some targets. >>> >>> This belongs in tree-ssa-math-opts.c:execute_optimize_bswap instead. >>> >> OK I'll have a look at that. Actually I modified fold-const.c because >> it's here that the similar 32 bits pattern is turned into a rotate. >> >>> When I implemented __builtin_bswap16, I didn't add this because I thought >>> this >>> would be overkill since the RTL combiner should be able to catch the >>> pattern. >>> Have you investigated on this front? But I don't have a strong opinion. >>> >> No I didn't. As I said above, I looked at where the 32 bits pattern >> was handled and added the 16 bits one. >> >> Christophe. > > Here is a new patch, modifying tree-ssa-math-opts.c as you suggested. > It's indeed simpler :-) > > Validated with qemu-arm on target arm-none-linux-gnueabi. > > OK?
Assuming this one was the lastest patch ... Ok. Thanks, Richard. > Christophe.