From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by sourceware.org (Postfix) with ESMTP id 7A954384243B for ; Fri, 8 Jan 2021 01:50:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7A954384243B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-mips.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=macro@linux-mips.org Received: from localhost.localdomain ([127.0.0.1]:39944 "EHLO localhost" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23993168AbhAHBuKoqsJE (ORCPT ); Fri, 8 Jan 2021 02:50:10 +0100 Date: Fri, 8 Jan 2021 01:50:10 +0000 (GMT) From: "Maciej W. Rozycki" To: Jeff Law , Paul Koning , Richard Sandiford , gcc-patches@gcc.gnu.org Subject: [PATCH 1/4] RTL: Update `const_double_zero' handling for mode and callable insns In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 01:50:15 -0000 Handle machine mode specification with `const_double_zero' and handle the rtx with callable code produced from named insns. Complementing commit 20ab43b5cad6 ("RTL: Add `const_double_zero' syntactic rtx") and removing a commit c60d0736dff7 ("PDP11: Use `const_double_zero' to express double zero constant") build regression observed with the `pdp11-aout' target: genemit: Internal error: abort in gen_exp, at genemit.c:202 make[2]: *** [Makefile:2427: s-emit] Error 1 where a: (const_double 0 [0] 0 [0] 0 [0] 0 [0]) rtx coming from: (parallel [ (set (reg:CC 16) (compare:CC (abs:DF (match_operand:DF 1 ("general_operand") ("0,0"))) (const_double 0 [0] 0 [0] 0 [0] 0 [0]))) (set (match_operand:DF 0 ("nonimmediate_operand") ("=fR,Q")) (abs:DF (match_dup 1))) ]) and ultimately `(const_double_zero)' referred in a named RTL insn cannot be interpreted. Handle the rtx then by supplying the constant 0 double operand requested, resulting in the following update to insn-emit.c code produced for the `pdp11-aout' target, relative to before the triggering commit: @@ -1514,7 +1514,7 @@ gen_absdf2_cc (rtx operand0 ATTRIBUTE_UN gen_rtx_COMPARE (CCmode, gen_rtx_ABS (DFmode, operand1), - const0_rtx)), + CONST_DOUBLE_ATOF ("0", VOIDmode))), gen_rtx_SET (operand0, gen_rtx_ABS (DFmode, copy_rtx (operand1))))); @@ -1555,7 +1555,7 @@ gen_negdf2_cc (rtx operand0 ATTRIBUTE_UN gen_rtx_COMPARE (CCmode, gen_rtx_NEG (DFmode, operand1), - const0_rtx)), + CONST_DOUBLE_ATOF ("0", VOIDmode))), gen_rtx_SET (operand0, gen_rtx_NEG (DFmode, copy_rtx (operand1))))); @@ -1790,7 +1790,7 @@ gen_muldf3_cc (rtx operand0 ATTRIBUTE_UN gen_rtx_MULT (DFmode, operand1, operand2), - const0_rtx)), + CONST_DOUBLE_ATOF ("0", VOIDmode))), gen_rtx_SET (operand0, gen_rtx_MULT (DFmode, copy_rtx (operand1), @@ -1942,7 +1942,7 @@ gen_divdf3_cc (rtx operand0 ATTRIBUTE_UN gen_rtx_DIV (DFmode, operand1, operand2), - const0_rtx)), + CONST_DOUBLE_ATOF ("0", VOIDmode))), gen_rtx_SET (operand0, gen_rtx_DIV (DFmode, copy_rtx (operand1), This does not (yet) remove VOIDmode CONST_DOUBLE use, as it is up to individual machine descriptions to choose. gcc/ * genemit.c (gen_exp) : Handle `const_double_zero' rtx. * read-rtl.c (rtx_reader::read_rtx_code): Handle machine mode with `const_double_zero'. * doc/rtl.texi (Constant Expression Types): Document it. --- gcc/doc/rtl.texi | 4 ++-- gcc/genemit.c | 8 ++++++++ gcc/read-rtl.c | 9 +++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) gcc-const-double-zero-mode.diff Index: gcc/gcc/doc/rtl.texi =================================================================== --- gcc.orig/gcc/doc/rtl.texi +++ gcc/gcc/doc/rtl.texi @@ -1719,13 +1719,13 @@ of code @code{const_double} and therefor provided: @smallexample -(const_double_zero) +(const_double_zero:@var{m}) @end smallexample standing for: @smallexample -(const_double 0 0 @dots{}) +(const_double:@var{m} 0 0 @dots{}) @end smallexample for matching the floating-point value zero, possibly the only useful one. Index: gcc/gcc/genemit.c =================================================================== --- gcc.orig/gcc/genemit.c +++ gcc/gcc/genemit.c @@ -195,6 +195,14 @@ gen_exp (rtx x, enum rtx_code subroutine return; case CONST_DOUBLE: + /* Handle `const_double_zero' rtx. */ + if (CONST_DOUBLE_REAL_VALUE (x)->cl == rvc_zero) + { + printf ("CONST_DOUBLE_ATOF (\"0\", %smode)", + GET_MODE_NAME (GET_MODE (x))); + return; + } + /* Fall through. */ case CONST_FIXED: case CONST_WIDE_INT: /* These shouldn't be written in MD files. Instead, the appropriate Index: gcc/gcc/read-rtl.c =================================================================== --- gcc.orig/gcc/read-rtl.c +++ gcc/gcc/read-rtl.c @@ -1658,6 +1658,15 @@ rtx_reader::read_rtx_code (const char *c return_rtx = rtx_alloc (code); memset (return_rtx, 0, RTX_CODE_SIZE (code)); PUT_CODE (return_rtx, code); + c = read_skip_spaces (); + if (c == ':') + { + file_location loc = read_name (&name); + record_potential_iterator_use (&modes, loc, return_rtx, 0, + name.string); + } + else + unread_char (c); return return_rtx; }