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: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to