Hi Thomas,
On 24 September 2014 10:01, Richard Biener <richard.guent...@gmail.com> wrote: > On Tue, Sep 16, 2014 at 12:24 PM, Thomas Preud'homme > <thomas.preudho...@arm.com> wrote: >> Hi all, >> >> The fix for PR61306 disabled bswap when a sign extension is detected. >> However this led to a test case regression (and potential performance >> regression) in case where a sign extension happens but its effect is >> canceled by other bit manipulation. This patch aims to fix that by having a >> special marker to track bytes whose value is unpredictable due to sign >> extension. If the final result of a bit manipulation doesn't contain any >> such marker then the bswap optimization can proceed. > > Nice and simple idea. > > Ok. > > Thanks, > Richard. > Although I could notice the improvement: Pass disappears [PASS => ]: gcc.dg/optimize-bswapsi-1.c scan-tree-dump-times bswap "32 bit bswap implementation found at" 3 New pass [ => PASS]: gcc.dg/optimize-bswapsi-1.c scan-tree-dump-times bswap "32 bit bswap implementation found at" 4 for arm-*, armeb-* and aarch64-* targets, there is no change for aarch64_be: is this expected? Christophe. >> *** gcc/ChangeLog *** >> >> 2014-09-15 Thomas Preud'homme <thomas.preudho...@arm.com> >> >> PR tree-optimization/63266 >> * tree-ssa-math-opts.c (struct symbolic_number): Add comment about >> marker for unknown byte value. >> (MARKER_MASK): New macro. >> (MARKER_BYTE_UNKNOWN): New macro. >> (HEAD_MARKER): New macro. >> (do_shift_rotate): Mark bytes with unknown values due to sign >> extension when doing an arithmetic right shift. Replace hardcoded >> mask for marker by new MARKER_MASK macro. >> (find_bswap_or_nop_1): Likewise and adjust ORing of two symbolic >> numbers accordingly. >> >> *** gcc/testsuite/ChangeLog *** >> >> 2014-09-15 Thomas Preud'homme <thomas.preudho...@arm.com> >> >> PR tree-optimization/63266 >> * gcc.dg/optimize-bswapsi-1.c (swap32_d): New bswap pass test. >> >> >> Testing: >> >> * Built an arm-none-eabi-gcc cross-compiler and used it to run the testsuite >> on QEMU emulating Cortex-M3 without any regression >> * Bootstrapped on x86_64-linux-gnu target and testsuite was run without >> regression >> >> >> Ok for trunk?