or1k: Fix improper placement of cbranchsi4 instructions

When investigating a builtin-arith-overflow-12.c test failure I found
the cause to be improper placement of a cbranchsi4 instruction.

In openrisc a cbranchsi4 instruction will be split to something like:

    (set (reg:BI ?sr_f)
	    (cmp:BI (reg:SI x) (reg:SI y)))
    (set (pc)
	    (if_then_else (eq (reg:BI ?sr_f)
		    (const_int 0 [0]))
		(label_ref:SI z)
		(pc)))

Between combine and late_combine1 optimization passes I found a case
where a cbranchsi4 was getting injected between the "set sr_f" and
"jump if sr_f" instructions.  The middle-end thought this was ok as it
could not see that the cbranchsi4 pattern will clobber the sr_f register
after splitting.

Add a clause to the cbranchsi4 pattern to indicate that it will clobber
sr_f.  This allows the middle-end to avoid placing the cbranchsi4
pattern incorrectly.

After this patch these tests pass.
  make check-gcc RUNTESTFLAGS='dg-torture.exp=builtin-arith-overflow-12.c'

gcc/ChangeLog:

	* config/or1k/or1k.md (cbranchsi4): Add clobber clause.

Signed-off-by: Stafford Horne <shorne@gmail.com>
(cherry picked from commit 3be38d59b2dda9d868ce5d9e1ec1218ce9a97129)
1 file changed