[SPARC] Tidy up Condition Code support and more

Eric Botcazou ebotcazou@adacore.com
Tue Oct 11 22:23:00 GMT 2016

> Note that the ADDXC, ADDXCCC, SUBXC and SUBXCCC instructions do not
> support immediate operands.  Hence the patch breaks vis3-enabling arches
> and niagara-7.

Egad.  I totally overlooked this (yet the -mcpu=niagara7 -m64 testsuite is 
rather explicit) and this is a bit of a shame, especially for SUBXC which 
becomes less useful, you need something like:

long foo2 (long a, long i)
  return a - (i != 0);

to generate it:

        cmp     %g0, %o1
        jmp     %o7+8
         subxc  %o0, %g0, %o0

> (Yes, ADXCC and SUBXCC both support immediate operands, it can be
> confusing :/)

The mere (re-)naming is already confusing. ;-)

Thanks for the heads up.  I have installed the attached corrective patch.

	* config/sparc/sparc.c (emit_scc_insn): Remove direct support for EQ
	and GEU in DImode if TARGET_SUBXC.
	* config/sparc/sparc.md (seqdi<W:mode>_zero): Remove TARGET_SUBXC.
	(seqdi<W:mode>_zero_subxc): Delete.
	(neg_seqdi<W:mode>_zero): Remove TARGET_VIS3.
	(neg_seqdi<W:mode>_zero_vis3): Delete.
	(plus_seqdi<W:mode>_zero): Likewise.
	(minus_seqdi<W:mode>_zero): Likewise.
	(plus_plus_sltu<W:mode>): Accept only register.
	(addx<W:mode>): Likewise.
	(plus_sltu<W:mode>_vis3): Likewise.
	(plus_plus_sltu<W:mode>_vis3): Likewise.
	(neg_sgeu<W:mode>_vis3): Delete.
	(minus_sgeu<W:mode>_vis3): Likewise.
	(addxc<W:mode>): Accept only registers.
	(neg_sltu<W:mode>_subxc): Write %%g0 instead of 0.
	(minus_neg_sltu<W:mode>_subxc): Accept only register.
	(neg_plus_sltu<W:mode>_subxc): Likewise.
	(minus_sltu<W:mode>_subxc): Write %%g0 instead of 0.
	(minus_minus_sltu<W:mode>_subxc): Accept only register.
	(sgeu<W:mode>_insn_subxc): Delete.
	(plus_sgeu<W:mode>_subxc): Likewise.
	(subxc<W:mode>): Accept only register.
	(scc splitter): Split always GEU again.
	* gcc.target/sparc/setcc-4.c: Adjust.
	* gcc.target/sparc/setcc-5.c: Likewise.
	* gcc.target/sparc/setcc-6.c: Likewise.
	* gcc.target/sparc/setcc-7.c: Likewise.
	* gcc.target/sparc/setcc-8.c: Likewise.
	* gcc.target/sparc/setcc-9.c: Likewise.
	* gcc.target/sparc/setcc-10.c: Delete.

Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 20964 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161011/ee3eacaa/attachment.bin>

More information about the Gcc-patches mailing list