On Thu, Jun 14, 2012 at 4:39 AM, Kaz Kojima <kkoj...@rr.iij4u.or.jp> wrote: > Oleg Endo <oleg.e...@t-online.de> wrote: >> The attached patch improves code generated for byte swap expressions >> such as ((x & 0xFF) << 8) | ((x >> 8) & 0xFF). >> It seems that currently the tree optimizers only detect bswap32 and >> bswap64 but not bswap16 patterns. The patch adds detection for bswap16 >> patterns by playing along with the combine pass. >> >> Tested with >> make -k -j8 check RUNTESTFLAGS="--target_board=sh-sim >> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m2a-single/-mb,-m4/-ml, >> -m4/-mb,-m4-single/-ml,-m4-single/-mb,-m4a-single/-ml, >> -m4a-single/-mb}" >> >> and no new failures. >> Test cases for this patch and the previous bswap32 patch will follow >> shortly. > > The patch looks fine to me. OK for trunk. > > I guess that tree optimizers handle bswap32/64 with its cost > because they are more frequent and critical in the real working > set like network codes than bswap16, though I could be wrong > about it.
I think the bswap16 builtin simply post-dates the bswap recognition code. Richard. > Regards, > kaz