On Mon, Jun 27, 2011 at 11:50 AM, Kai Tietz <ktiet...@googlemail.com> wrote: > 2011/6/27 Richard Guenther <richard.guent...@gmail.com>: >> On Mon, Jun 27, 2011 at 10:06 AM, Kai Tietz <kti...@redhat.com> wrote: >>> Hello, >>> >>> this patch improves the bswap (32/64) detection and fixes an issue about >>> shifted bit values out of type-size precision. >>> >>> ChangeLog >>> >>> 2011-06-27 Kai Tietz <kti...@redhat.com> >>> >>> * tree-ssa-math-opts.c (do_shift_rotate): Zero bits >>> out of type precision after operation. >>> (find_bswap): Take for limit value the integer auto- >>> promotion into account. >>> >>> ChangeLog >>> >>> 2011-06-27 Kai Tietz <kti...@redhat.com> >>> >>> * gcc.dg/optimize-bswapdi-2.c: New test. >>> >>> Bootstrapped and regression tested for x86_64-pc-linux-gnu. Ok for apply? >> >> The do_shift_rotate hunk is ok. Where did you get the testcase from? >> I can easily construct testcases that go via an intermediate SImode step >> and the still won't be recongized. Thus, is the testcase practically >> relevant? If so we should add 1 + log2 (byte-size) instead of 3 to also >> cover the SImode -> HImode intermediate case. >> >> Thanks, >> Richard. > > Ok, I can adjust it to use here 1 + 3 (for byte-size covering the > SImode -> HImode intermediate case). I was seen a regression for > bswap detection by doing in forward-propagate a type-sinking on (type) > X op (type) Y (for X and Y with compatible type), and (type) X op CST > (for ((type) (type-x) CST) == CST case. I will sent soon a patch for > this optimization related thing. By this I detected that bswap > algorithm didn't zero'ed upper bits out of size-range. > > Ok with that change?
Ok with using 1 + ceil_log2 (TREE_INT_CST_LOW (TYPE_SIZE_UNIT (...))), CSE that TREE_INT_CST_LOW. Thanks, Richard. > Regards, > Kai >