[LLVMbugs] [Bug 13623] New: powerpc64 parameter save area handling does not match PPC64 ELF ABI

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 16 14:07:42 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13623

             Bug #: 13623
           Summary: powerpc64 parameter save area handling does not match
                    PPC64 ELF ABI
           Product: new-bugs
           Version: trunk
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: wschmidt at linux.vnet.ibm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


On powerpc64-unknown-linux-gnu, the layout of the parameter save area is not
compatible with the 64-bit PowerPC ELF Application Binary Interface Supplement
(see http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html).  In
particular, simple integer types and single-precision floating-point types are
supposed to each be mapped to a separate doubleword (see section 3.2.3). 
Instead, two adjacent "int" and/or "float" parameters share the same
doubleword.

Consider:

static int
passem (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
  return ((a * b) + (c * d) - (e * f)) / (g + h - i + j);
}

The beginning of the generated assembly code shows the parameters being stored
in adjacent four-byte fields:

.L.passem:
    std 29, -24(1)
    std 30, -16(1)
    mr 11, 3
    stw 11, -28(1)
    mr 11, 4
    stw 11, -32(1)
    mr 11, 5
    stw 11, -36(1)
    mr 11, 6
    stw 11, -40(1)
    mr 11, 7
    stw 11, -44(1)
    mr 11, 8
    stw 11, -48(1)
    lwz 11, 116(1)
    mr 12, 9
    lwz 30, 124(1)
    stw 12, -52(1)
    mr 12, 10
    stw 12, -56(1)
    stw 11, -60(1)
    stw 30, -64(1)
    lwz 11, -40(1)
    lwz 12, -36(1)

A similar bit of example code shows the same thing for floating-point:

static float
passem (float a, float b, float c, float d, float e,
    float f, float g, float h, float i, float j)
{
  return ((a * b) + (c * d) - (e * f)) / (g + h - i + j);
}

.L.passem:
    stfd 28, -32(1)
    stfd 29, -24(1)
    stfd 30, -16(1)
    stfd 31, -8(1)
    stfs 1, -36(1)
    stfs 2, -40(1)
    stfs 3, -44(1)
    stfs 4, -48(1)
    stfs 5, -52(1)
    stfs 6, -56(1)
    stfs 7, -60(1)
    stfs 8, -64(1)
    stfs 9, -68(1)
    stfs 10, -72(1)

In both cases, the addresses should be eight bytes apart, with ints
sign-extended to an eight-byte value, and floats residing in the second word of
the doubleword.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list