[llvm-bugs] [Bug 46966] New: Suboptimal codegen for v2sf operations - should use MOVLPS

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 3 07:16:39 PDT 2020


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

            Bug ID: 46966
           Summary: Suboptimal codegen for v2sf operations - should use
                    MOVLPS
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

float r[2], a[2], b[2], c[2];

void test_plus(void) {
  for (int i = 0; i < 2; i++) r[i] = a[i] + b[i];
}


Clang:
test_plus:                              # @test_plus
        movss   xmm0, dword ptr [rip + a]       # xmm0 = mem[0],zero,zero,zero
        addss   xmm0, dword ptr [rip + b]
        movss   dword ptr [rip + r], xmm0
        movss   xmm0, dword ptr [rip + a+4]     # xmm0 = mem[0],zero,zero,zero
        addss   xmm0, dword ptr [rip + b+4]
        movss   dword ptr [rip + r+4], xmm0
        ret

GCC:
test_plus:
        movq    xmm0, QWORD PTR a[rip]
        movq    xmm1, QWORD PTR b[rip]
        addps   xmm0, xmm1
        movlps  QWORD PTR r[rip], xmm0
        ret




Godbolt: https://godbolt.org/z/fnxGj1

-- 
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/20200803/a4394945/attachment.html>


More information about the llvm-bugs mailing list