Complement commit 20ab43b5cad6 ("RTL: Add `const_double_zero' syntactic 
rtx") and remove 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),

        gcc/
        * genemit.c (gen_exp) <CONST_DOUBLE>: Handle `const_double_zero' 
        rtx.
---
Hi,

 I have verified this with a bootstrap of a `powerpc64le-linux-gnu' native 
compiler, and that it builds a `pdp11-aout' cross-compiler up to the point 
of failing to find target headers.  I have no means to verify it further, 
the target configuration is too exotic to me, so I will appreciate help.

 NB this only triggers with insn-emit.c code produced from named RTL insns 
for the purpose of calling them directly, which does not apply for the VAX 
backend, as it does not give names to any insns using `const_double_zero'.  
Which is why I didn't spot this issue with all my VAX verification.

 Thanks to Martin for bringing my attention to this regression, and sorry 
to miss this in testing.

 OK to apply?

  Maciej
---
 gcc/genemit.c |    8 ++++++++
 1 file changed, 8 insertions(+)

gcc-genemit-const-double-zero.diff
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

Reply via email to