On Sun, Nov 20, 2016 at 10:00 PM, Uros Bizjak <ubiz...@gmail.com> wrote: >>> This also eliminate quite a few zero-extensions in the compile.exp testsuite >>> at -O2 on the SPARC. Tested on x86-64/Linux and SPARC/Solaris. >>> >>> >>> 2016-11-07 Eric Botcazou <ebotca...@adacore.com> >>> >>> PR rtl-optimization/59461 >>> * doc/rtl.texi (paradoxical subregs): Add missing word. >>> * combine.c (reg_nonzero_bits_for_combine): Do not discard results >>> in modes with precision larger than that of last_set_mode. >>> * rtlanal.c (nonzero_bits1) <SUBREG>: If WORD_REGISTER_OPERATIONS is >>> set and LOAD_EXTEND_OP is appropriate, propagate results from inner >>> REGs to paradoxical SUBREGs. >>> (num_sign_bit_copies1) <SUBREG>: Likewise. Check that the mode is not >>> larger than a word before invoking LOAD_EXTEND_OP on it. >> >> I have installed it after testing on ARM/EABI and IA-64/Linux. > > Just a heads-up for now, the above patch introduced following > testsuite failures on Alpha [1]: > > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-1.c -O2 execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-1.c -O3 -g execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-1.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-1.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-2.c -O2 execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-2.c -O3 -g execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-2.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none execution test > FAIL: gcc.dg/atomic/stdatomic-compare-exchange-2.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects execution test > > On a first look, it looks that something is wrong with sign-extensions. > > I will try to look into this a bit more.
Your patch exposes a problem in the ree pass where: 50: $22:QI=$8:QI REG_EQUAL [`expected'] 43: [$2:DI+low(`expected')]=$8:QI 51: $3:DI=sign_extend($22:QI) gets converted to: 50: $3:DI=sign_extend($8:QI) 141: $22:DI=$3:DI 43: [$2:DI+low(`expected')]=$8:QI $22:DI is used later in a fallthrough block, and the above sequences are certainly not equal wrt. to $22. The first one does have all high bits of $22 zero, the second one doesn't. -fno-ree fixes the failures. I will fill a PR tomorrow. Uros.