https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109279

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-03-24
             Status|UNCONFIRMED                 |NEW
            Summary|[13 Regression] RISC-V:     |RISC-V: complex constants
                   |complex constants           |synthesized should be
                   |synthesized vs. fetching    |improved
                   |from constant pool          |
     Ever confirmed|0                           |1

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Take:
long long f(void)
{
  return 0x0101010101010101ull;
}

---- CUT ----
This should be done as:
        li      a0,16842752
        addi    a0,a0,257
        slli    a1,a0,32
        or      a0,a0,a1
Which is what this produces:
```
long long f(void)
{
  unsigned t = 16843009;
  long long t1 = t;
  long long t2 = ((unsigned long long )t) << 32;
  asm("":"+r"(t1));
  return t1 | t2;
}
```
I suspect: 0x0080402010080400ULL should be done as two 32bit with a shift/or
added too. Will definitely improve complex constants forming too.

Right now the backend does (const<<16+const)<<16+const... which is just so bad.

Reply via email to