[llvm-bugs] [Bug 50088] New: LLVM 12 generates poor PowerPC-SPE code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 22 23:34:53 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50088

            Bug ID: 50088
           Summary: LLVM 12 generates poor PowerPC-SPE code
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: patrick.oppenlander at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

For the following test case:

extern float bar(float);
float foo(float a, float b)
{
        return bar(a) * b;
}

GCC 8.4.0 generates

00000000 <foo>:
   0:   94 21 ff f0     stwu    r1,-16(r1)
   4:   7c 08 02 a6     mflr    r0
   8:   93 e1 00 0c     stw     r31,12(r1)
   c:   7c 9f 23 78     mr      r31,r4
  10:   90 01 00 14     stw     r0,20(r1)
  14:   48 00 00 01     bl      14 <foo+0x14>
  18:   80 01 00 14     lwz     r0,20(r1)
  1c:   10 63 fa c8     efsmul  r3,r3,r31
  20:   83 e1 00 0c     lwz     r31,12(r1)
  24:   38 21 00 10     addi    r1,r1,16
  28:   7c 08 03 a6     mtlr    r0
  2c:   4e 80 00 20     blr

LLVM 12.0.0 generates

00000000 <foo>:
   0:   7c 08 02 a6     mflr    r0
   4:   90 01 00 04     stw     r0,4(r1)
   8:   94 21 ff d0     stwu    r1,-48(r1)
   c:   93 c1 00 28     stw     r30,40(r1)
  10:   93 a1 00 24     stw     r29,36(r1)
  14:   13 a1 0b 21     evstdd  r29,8(r1)
  18:   7c 9d 23 78     mr      r29,r4
  1c:   13 c1 13 21     evstdd  r30,16(r1)
  20:   48 00 00 05     bl      24 <foo+0x24>
  24:   7f c8 02 a6     mflr    r30
  28:   3f de 00 00     addis   r30,r30,0
  2c:   3b de 00 00     addi    r30,r30,0
  30:   48 00 00 01     bl      30 <foo+0x30>
  34:   10 63 ea c8     efsmul  r3,r3,r29
  38:   13 c1 13 01     evldd   r30,16(r1)
  3c:   13 a1 0b 01     evldd   r29,8(r1)
  40:   83 a1 00 24     lwz     r29,36(r1)
  44:   80 01 00 34     lwz     r0,52(r1)
  48:   83 c1 00 28     lwz     r30,40(r1)
  4c:   38 21 00 30     addi    r1,r1,48
  50:   7c 08 03 a6     mtlr    r0
  54:   4e 80 00 20     blr

It looks like the biggest problem is that LLVM is unnecessarily storing the
extended (64-bit) versions of r29 and r30.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210423/919c471f/attachment.html>


More information about the llvm-bugs mailing list