[Patch, microblaze]: Correct the const high double immediate value

Nagaraju Mekala nmekala@xilinx.com
Wed Nov 11 17:42:50 GMT 2020


Hi Eager,

> -----Original Message-----
> From: Michael Eager <eager@eagercon.com>
> Sent: Wednesday, November 11, 2020 9:06 AM
> To: Nagaraju Mekala <nmekala@xilinx.com>; Michael Eager
> <eager@eagercon.com>; gcc-patches@gcc.gnu.org
> Cc: Sadanand Mutyala <sadanan@xilinx.com>
> Subject: Re: [Patch, microblaze]: Correct the const high double immediate
> value
> 
> On 11/8/20 9:43 PM, Nagaraju Mekala wrote:
> > diff --git a/gcc/config/microblaze/microblaze.c
> > b/gcc/config/microblaze/microblaze.c
> >
> > index a0f81b7..d9341ec 100644
> > --- a/gcc/config/microblaze/microblaze.c
> > +++ b/gcc/config/microblaze/microblaze.c
> > @@ -2440,15 +2440,18 @@ print_operand (FILE * file, rtx op, int
> > letter)
> >     else if (letter == 'h' || letter == 'j')
> >       {
> > -      long val[2];
> > +      long val[2], l[2];
> >         if (code == CONST_DOUBLE)
> >          {
> >            if (GET_MODE (op) == DFmode)
> >              REAL_VALUE_TO_TARGET_DOUBLE
> (*CONST_DOUBLE_REAL_VALUE
> > (op), val);
> >            else
> >              {
> > -             val[0] = CONST_DOUBLE_HIGH (op);
> > -             val[1] = CONST_DOUBLE_LOW (op);
> > +             REAL_VALUE_TYPE rv;
> > +             REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
> 
> REAL_VALUE_FROM_CONST_DOUBLE was removed from real.h in 2015.
> Use CONST_DOUBLE_REAL_VALUE.
> 
> > +             REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
> > +             val[1] = l[WORDS_BIG_ENDIAN == 0];
> > +             val[0] = l[WORDS_BIG_ENDIAN != 0];
> >              }
> >          }
> >         else if (code == CONST_INT)
> 
> 
> > diff --git a/gcc/testsuite/gcc.target/microblaze/long.c
> > b/gcc/testsuite/gcc.target/microblaze/long.c
> > new file mode 100644
> > index 0000000..4d45186
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/microblaze/long.c
> > @@ -0,0 +1,10 @@
> > +/* { dg-options "-O0" } */
> > +#define BASEADDR 0xF0000000ULL
> > +int main ()
> > +{
> > +  unsigned long long start;
> > +  start = (unsigned long long) BASEADDR;
> > +  return 0;
> > +}
> > +/* { dg-final { scan-assembler
> > "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x00000000" } } */
> > +/* { dg-final { scan-assembler
> > "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf0000000" } } */
> 
> It looks like this test case will pass without the patch.  The code
> generated before applying the patch is
>          addik   r4,r0,0x00000000
>          addik   r5,r0,0xf0000000 #li => la
> 
> Can you provide a test case which fails without the patch but passes
> with the patch?
Thanks for reviewing the patch, I will update both patch and testcase and re-submit them.

Thanks,
Nagaraju
> 
> --
> Michael Eager


More information about the Gcc-patches mailing list