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]

[RFA:] equiv_init_movable_p: References to CC0 are not movable.


Long rant for a one-line patch, important for all cc0 machines;
i.e. not to any of SPARC, MIPS, Alpha, PPC, ARM, ia32(x86) or ia64.

The head comment for equiv_init_movable_p says:

/* Returns non-zero if X (used to initialize register REGNO) is movable.
   X is only movable if the registers it uses have equivalent initializations
   which appear to be within the same loop (or in an inner loop) and movable
   or if they are not candidates for local_alloc and don't vary.  */

So for the purpose of this function, a reference to CC0 is not
movable until code is added for moving the user and setter as a
pair.  (Repeat 1 << 32 times: "Nothing [but notes] come between
a cc0 setter and user on a cc0 machine".)  This function is used
in one place, and if the predicate returns 1, an
equivalence-insn may be moved immediately before the using insn.
This happened to insn 32 for CRIS in the following
(950512-1.c.15.ce):

(note 4 3 31 NOTE_INSN_FUNCTION_BEG -1347440721)

(insn 31 4 32 (set (cc0)
        (reg:SI 10 r10)) 1 {tstsi} (nil)
    (expr_list:REG_DEAD (reg:SI 10 r10)
        (nil)))

(insn 32 31 33 (set (reg:SI 24)
        (eq:SI (cc0)
            (const_int 0 [0x0]))) 174 {seq} (nil)
    (nil))

(insn 33 32 34 (set (reg:SI 25)
        (const_int 2147483647 [0x7fffffff])) 33 {movsi} (nil)
    (expr_list:REG_EQUAL (const_int 2147483647 [0x7fffffff])
        (nil)))

(note 34 33 11 NOTE_INSN_DELETED 0)

(note 11 34 19 NOTE_INSN_DELETED 0)

(insn 19 11 26 (set (reg/i:SI 10 r10)
        (minus:SI (reg:SI 25)
            (reg:SI 24))) 71 {subsi3} (insn_list 33 (insn_list 32 (nil)))
    (expr_list:REG_DEAD (reg:SI 25)
        (expr_list:REG_DEAD (reg:SI 24)
            (nil))))

...

The cc0-setter and user are moved apart since insn 32 is
incorrectly decided as movable to before insn 19
(950512-1.c.18.lreg):

...

(note 4 3 31 NOTE_INSN_FUNCTION_BEG -1347440721)

(insn 31 4 32 (set (cc0)
        (reg:SI 10 r10)) 1 {tstsi} (nil)
    (expr_list:REG_DEAD (reg:SI 10 r10)
        (nil)))

(note 32 31 33 NOTE_INSN_DELETED 0)

(note 33 32 34 NOTE_INSN_DELETED 0)

(note 34 33 11 NOTE_INSN_DELETED 0)

(note 11 34 35 NOTE_INSN_DELETED 0)

(insn 35 11 36 (set (reg:SI 25)
        (const_int 2147483647 [0x7fffffff])) 33 {movsi} (nil)
    (expr_list:REG_EQUIV (const_int 2147483647 [0x7fffffff])
        (nil)))

(insn 36 35 19 (set (reg:SI 24)
        (eq:SI (cc0)
            (const_int 0 [0x0]))) 174 {seq} (nil)
    (expr_list:REG_EQUIV (eq:SI (cc0)
            (const_int 0 [0x0]))
        (nil)))

(insn 19 36 26 (set (reg/i:SI 10 r10)
        (minus:SI (reg:SI 25)
            (reg:SI 24))) 71 {subsi3} (insn_list 33 (insn_list 32 (nil)))
    (expr_list:REG_DEAD (reg:SI 25)
        (expr_list:REG_DEAD (reg:SI 24)
            (nil))))

...

For a cc0-machine, this problem shows up in a number of
test-cases other than 950512-1.c.  I would be surprised if any
cc0-machine bootstraps without this patch.  YMMV, but for CRIS
this correction cures failures for:

libio.tests:
tFile.cc output 
tFile.cc output -b0
tFile.cc output -b3
tfformat.c execution 

gcc:
gcc.c-torture/execute/20000313-1.c execution,  -O1 
gcc.c-torture/execute/20000313-1.c execution,  -O2 
gcc.c-torture/execute/20000313-1.c execution,  -Os 
gcc.c-torture/execute/950512-1.c execution,  -O1 
gcc.c-torture/execute/950706-1.c execution,  -O0 
gcc.c-torture/execute/950706-1.c execution,  -O1 
gcc.c-torture/execute/950706-1.c execution,  -O2 
gcc.c-torture/execute/950706-1.c execution,  -Os 
gcc.c-torture/execute/ieee/920810-1.c execution,  -O3 -fssa 

g++:
g++.eh/cleanup1.C  Execution test
g++.mike/eh10.C  Execution test
g++.other/dyncast3.C  Execution test
g++.other/vtbl2.C  Execution test


Bootstrapped on i686-pc-linux-gnu with no regressions, (at least
at the time immediately before the c-dump.h lossage) but this
unfortunately has no bearing on cc0 changes.  Hosted
HAVE_cc0-machines are scarce these days.  Film at 11.  (Why oh
why did you have to rewrite ia32 to non-cc0? :-)

Ok to commit?

	* local-alloc.c (equiv_init_movable_p): References to CC0 are not
	movable.

Index: local-alloc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/local-alloc.c,v
retrieving revision 1.73
diff -c -p -r1.73 local-alloc.c
*** local-alloc.c	2000/11/07 22:49:53	1.73
--- local-alloc.c	2000/11/11 02:49:13
*************** equiv_init_movable_p (x, regno)
*** 589,594 ****
--- 589,595 ----
      case SET:
        return equiv_init_movable_p (SET_SRC (x), regno);
  
+     case CC0:
      case CLOBBER:
        return 0;
  

brgds, H-P

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