This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/63281] New: powerpc64le creates 64 bit constants from scratch instead of loading them


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

            Bug ID: 63281
           Summary: powerpc64le creates 64 bit constants from scratch
                    instead of loading them
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anton at samba dot org

The following testcase:

#define CONST1 0x1234567812345678
#define CONST2 0x2345678123456781
#define CONST3 0x3456781234567812
#define CONST4 0x4567812345678123
#define CONST5 0x5678123456781234
#define CONST6 0x6781234567812345
#define CONST7 0x7812345678123456
#define CONST8 0x8123456781234567

void foo(unsigned long *a, unsigned long *b, unsigned long *c,
         unsigned long *d, unsigned long *e, unsigned long *f,
         unsigned long *g, unsigned long *h)
{
        *a = CONST1;
        *b = CONST2;
        *c = CONST3;
        *d = CONST4;
        *e = CONST5;
        *f = CONST6;
        *g = CONST7;
        *h = CONST8;
}

produces some pretty horrible code. We really should be loading the constants.
This looks to be present on 4.8, 4.9 and 5.0.

foo:
    std 27,-40(1)
    std 28,-32(1)
    lis 27,0x1234
    lis 28,0x2345
    std 29,-24(1)
    std 30,-16(1)
    lis 29,0x3456
    lis 30,0x4567
    std 31,-8(1)
    lis 31,0x5678
    ori 27,27,0x5678
    ori 28,28,0x6781
    ori 29,29,0x7812
    ori 30,30,0x8123
    ori 31,31,0x1234
    sldi 27,27,32
    sldi 28,28,32
    sldi 29,29,32
    sldi 30,30,32
    sldi 31,31,32
    lis 12,0x6781
    lis 0,0x7812
    lis 11,0x8123
    oris 27,27,0x1234
    oris 28,28,0x2345
    oris 29,29,0x3456
    oris 30,30,0x4567
    oris 31,31,0x5678
    ori 27,27,0x5678
    ori 28,28,0x6781
    ori 29,29,0x7812
    ori 30,30,0x8123
    ori 31,31,0x1234
    std 27,0(3)
    ld 27,-40(1)
    ori 12,12,0x2345
    ori 0,0,0x3456
    std 28,0(4)
    std 29,0(5)
    ori 11,11,0x4567
    sldi 12,12,32
    std 30,0(6)
    ld 28,-32(1)
    ld 29,-24(1)
    sldi 0,0,32
    sldi 11,11,32
    std 31,0(7)
    ld 30,-16(1)
    ld 31,-8(1)
    oris 12,12,0x6781
    oris 0,0,0x7812
    oris 11,11,0x8123
    ori 12,12,0x2345
    ori 0,0,0x3456
    ori 11,11,0x4567
    std 12,0(8)
    std 0,0(9)
    std 11,0(10)
    blr


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]