On Thu, Nov 03, 2016 at 05:43:50PM +0100, Bernd Schmidt wrote:
> On 11/03/2016 05:35 PM, Martin Jambor wrote:
> > 
> >     * print-rtl.c (print_rtx_operand_codes_E_and_V): Print how many times
> >     an element is repeated istead of printing each repeated element.
> 
> "instead"

Will fix.

> 
> > ---
> >  gcc/print-rtl.c | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
> > index 341ecdf..9752c85 100644
> > --- a/gcc/print-rtl.c
> > +++ b/gcc/print-rtl.c
> > @@ -252,7 +252,20 @@ rtx_writer::print_rtx_operand_codes_E_and_V (const_rtx 
> > in_rtx, int idx)
> >     m_sawclose = 1;
> > 
> >        for (int j = 0; j < XVECLEN (in_rtx, idx); j++)
> > -   print_rtx (XVECEXP (in_rtx, idx, j));
> > +   {
> > +     int j1;
> > +
> > +     print_rtx (XVECEXP (in_rtx, idx, j));
> > +     for (j1 = j + 1; j1 < XVECLEN (in_rtx, idx); j1++)
> > +       if (XVECEXP (in_rtx, idx, j) != XVECEXP (in_rtx, idx, j1))
> > +         break;
> > +
> > +     if (j1 != j + 1)
> > +       {
> > +         fprintf (m_outfile, " repeated %ix", j1 - j);
> > +         j = j1;
> > +       }
> > +   }
> 
> Good idea, but can you give an example of how this looks in
> practice?

For example, after the patch dumps of constant vectors look like this:

(insn 27 26 28 2 (set (reg:V64SI 450)
        (vec_merge:V64SI (ashift:V64SI (reg/v:V64SI 433 [ workitem_id ])
                (const_vector:V64SI [
                        (const_int 2 [0x2]) repeated 64x
                    ]))
            (unspec:V64SI [
                    (const_int 0 [0])
                ] UNSPEC_VECTOR)
            (reg:DI 425 [ exec.1_4 ]))) "kernel.c":35 -1
     (nil))

Without it, the very same insn is printed as following:

(insn 27 26 28 2 (set (reg:V64SI 450)
        (vec_merge:V64SI (ashift:V64SI (reg/v:V64SI 433 [ workitem_id ])
                (const_vector:V64SI [
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                        (const_int 2 [0x2])
                    ]))
            (unspec:V64SI [
                    (const_int 0 [0])
                ] UNSPEC_VECTOR)
            (reg:DI 425 [ exec.1_4 ]))) "kernel.c":35 -1
     (nil))

> Also,
> it would be nice (and necessary for David's rtl-testing) to also teach the
> rtl reader to parse this format.
> 

I see, thanks for the pointer, I will have a look at it, although I
may not make it soon enough for gcc 7.

Martin

Reply via email to