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

            Bug ID: 69143
           Summary: PowerPC64: aggregate results are badly handled
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anton at samba dot org
  Target Milestone: ---

This testcase:

struct foo1 {
        float x;
        float y;
};

struct foo1 blah1(struct foo1 y)
{
        struct foo1 x;

        x.x = y.y;
        x.y = y.x;

        return x;
}

Compiled with:

gcc -fno-stack-protector -mcpu=power8 -O2

Results in the following code:

blah1:
        xscvdpspn 12,2
        stfs 1,-16(1)
        ori 2,2,0
        lwz 8,-16(1)
        mfvsrd 10,12
        mr 9,8
        rldicl 9,9,0,32
        srdi 10,10,32
        sldi 10,10,32
        or 9,9,10
        rotldi 9,9,32
        mr 10,9
        srdi 9,9,32
        sldi 8,10,32
        sldi 10,9,32
        mtvsrd 1,8
        mtvsrd 2,10
        xscvspdpn 1,1
        xscvspdpn 2,2
        blr


I was expecting a couple of FPR moves. Clang does what I expected:

blah1:
        fmr 0, 1
        fmr 1, 2
        fmr 2, 0
        blr

Reply via email to