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

palmer at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-06-27
     Ever confirmed|0                           |1
                 CC|                            |palmer at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from palmer at gcc dot gnu.org ---
Looks reasonable to me.  Here's a slightly smaller test case

long bar(unsigned int a, unsigned int b, unsigned int c);

long foo(void) {
    unsigned int a = 0x4010; // (0x4 << 12) + 0x10
    unsigned int b = 0x4020; // (0x4 << 12) + 0x20
    unsigned int c = 0x3FF0; // (0x4 << 12) - 0x10
    return bar(a, b, c);
}

which under -O2 produces

        li      a2,16384
        li      a1,16384
        li      a0,16384
        addi    a2,a2,-16
        addi    a1,a1,32
        addi    a0,a0,16
        tail    bar

Jeff had been doing a bunch of constant generation stuff, not sure if he's got
a fix for this one in the works?

Reply via email to