This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 4.8, i386]: Make CCZ mode compatible with CCGOC, CCGO and CCNO modes


Hello!

Attached patch declares CCZmode compatible with CCGOC, CCGO and CCNO modes.

2012-02-07  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.c (ix86_cc_modes_compatible): Declare CCZmode
	compatible with CCGOCmode, CCGCmode and CCNOmode.

Bootstrapped on x86_64-pc-linux-gnu, regression test still in progress.

This patch (together with previous combine/i386 proto-patch) is still
not enough to remove redundant test instruction from

int test (int a, int b)
{
  int lt = a + b < 0;
  int eq = a + b == 0;
  if (lt)
    return 1;
  return eq;
}

It looks to me that something is wrong with compare-elim pass. Since
CCZmode is now made compatible with CCGOCmode (and results in
CCGOCmode), compare-elim pass should update the comparison mode in

> (insn 9 8 10 2 (parallel [
>            (set (reg:SI 5 di [orig:60 D.1710 ] [60])
>                (plus:SI (reg/v:SI 5 di [orig:63 a ] [63])
>                    (reg/v:SI 4 si [orig:64 b ] [64])))
>            (set (reg:CCZ 17 flags)
>                (compare:CCZ (plus:SI (reg/v:SI 5 di [orig:63 a ] [63])
>                        (reg/v:SI 4 si [orig:64 b ] [64]))
>                    (const_int 0 [0])))
>        ]) cmp.c:4 261 {*addsi_2}
>     (nil))

to CCGOCmode and eliminate CCGOC compare:

> (insn 29 30 31 2 (set (reg:CCGOC 17 flags)
>        (compare:CCGOC (reg:SI 5 di [orig:60 D.1710 ] [60])
>            (const_int 0 [0]))) cmp.c:6 2 {*cmpsi_ccno_1}
>     (nil))

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]