On Sat, Feb 11, 2012 at 9:41 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>>> Attached patch declares CCZmode compatible with CCGOC, CCGO and CCNO modes. >> >> Actually, CCZ mode is not compatible with CCNO mode, since the later >> only declares that overflow flag is not set. CCGOC and CCGO declare >> garbage in overflow (and carry in case of CCGOC) flag, so implicitly >> declare that CCZ flag is valid. Following this reasoning, CCZ mode >> should be compatible with CCGOC and CCGO modes. >> >> 2012-02-07 Uros Bizjak <ubiz...@gmail.com> >> >> * config/i386/i386.c (ix86_cc_modes_compatible): Declare CCZmode >> compatible with CCGOCmode and CCGCmode. >> >> Attached patch was bootstrapped and regression tested on x86_64-pc-linux-gnu. > > ... where it uncovers another problem how RTL optimizer handles > compatible compares! > CSE2 pass eliminated (insn 11), which is OK since CCZ is compatible > with CCGC, so (CCGC, CCZ)->CCGC. However, the pass also changed the > mode of flags register in (insn 12). I don't think this is correct, > the user should not be changed at all. This is also where my proposed patch [1] for post-reload compare elimination differs from CSE2 pass. The proposed revision doesn't update the mode of flags reg of users to calculated compatible mode. FWIW, the mode of flags in users doesn't matter at all on x86, but which way is correct? [1] http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00466.html Uros.