Jeff Law 1d5bc3285e [committed][RISC-V] Fix 20010221-1.c with zicond
So we're being a bit too aggressive with the .opt zicond patterns.

> (define_insn "*czero.eqz.<GPR:mode><X:mode>.opt1"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (eq (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "1")
>                           (match_operand:GPR 3 "register_operand" "r")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1], operands[2])"
>   "czero.eqz\t%0,%3,%1"
> )
The RTL semantics here are op0 = (op1 == 0) ? op1 : op2.  That maps
directly to czero.eqz.  ie, we select op1 when we know it's zero, op2
otherwise.  So this pattern is fine.

> (define_insn "*czero.eqz.<GPR:mode><X:mode>.opt2"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (eq (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "r")
>                           (match_operand:GPR 3 "register_operand" "1")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1],  operands[3])"
>   "czero.nez\t%0,%2,%1"
> )

The RTL semantics of this pattern are are: op0 = (op1 == 0) ? op2 : op1;

That's not something that can be expressed by the zicond extension as it
selects op1 if and only if op1 is not equal to zero.

> (define_insn "*czero.nez.<GPR:mode><X:mode>.opt3"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (ne (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "r")
>                           (match_operand:GPR 3 "register_operand" "1")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1], operands[3])"
>   "czero.eqz\t%0,%2,%1"
> )
The RTL semantics of this pattern are op0 = (op1 != 0) ? op2 : op1.
That maps to czero.nez.  But the output template uses czero.eqz.  Opps.

> (define_insn "*czero.nez.<GPR:mode><X:mode>.opt4"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (ne (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "1")
>                           (match_operand:GPR 3 "register_operand" "r")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1], operands[2])"
>   "czero.nez\t%0,%3,%1"
> )

The RTL semantics of this pattern are op0 = (op1 != 0) ? op1 : op2 which
obviously doesn't match to any zicond instruction as op1 is selected
when it is not zero.

So two of the patterns are just totally bogus as they are not
implementable with zicond.  They are removed.  The asm template for the
.opt3 pattern is fixed to use czero.nez and its name is changed to
.opt2.

gcc/
	* config/riscv/zicond.md: Remove incorrect zicond patterns and
	renumber/rename them.
	(zero.nez.<GPR:MODE><X:mode>.opt2): Fix output string.
2023-08-02 13:16:23 -04:00
2023-06-23 00:16:38 +00:00
2023-07-22 00:17:44 +00:00
2023-07-14 00:16:43 +00:00
2023-06-16 00:17:18 +00:00
2023-07-30 00:17:03 +00:00
2023-06-16 00:17:18 +00:00
2023-08-01 00:18:39 +00:00
2023-06-16 00:17:18 +00:00
2023-07-20 00:17:53 +00:00
2023-06-16 00:17:18 +00:00
2023-07-24 00:16:51 +00:00
2023-07-22 00:17:44 +00:00
2023-07-30 00:17:03 +00:00
2023-06-16 00:17:18 +00:00
2023-07-11 00:16:56 +00:00
2023-07-31 00:16:58 +00:00
2023-07-01 00:18:32 +00:00
2023-07-08 00:16:53 +00:00
2023-06-17 00:17:17 +00:00
2023-08-02 00:17:45 +00:00
2023-07-31 11:37:47 +02:00
2023-07-31 11:37:47 +02:00
2023-07-31 11:37:47 +02:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.8%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.3%