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

            Bug ID: 50392
           Summary: Compiler no longer producing single horizontal add
                    instruction after ab2c499d
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: douglas_y...@playstation.sony.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

One of our internal tests compiles the following code and verifies that it
generates a horizontal add instruction in the resulting assembly when
optimizations are enabled and targeting btver2.

__attribute__((noinline))
__m256d add_pd_002(__m256d a, __m256d b) {
  __m256d r = (__m256d){ a[0] + a[1], a[2] + a[3], b[0] + b[1], b[2] + b[3] };
  return __builtin_shufflevector(r, a, 0, -1, 2, 3);
}

Prior to commit ab2c499, when compiled with "-g0 -O3 -march=btver2", the
compiler would produce the following code:

        vinsertf128     $1, %xmm1, %ymm0, %ymm0
        vhaddpd %ymm1, %ymm0, %ymm0

But following the mentioned change, the compiler is now producing the following
code instead:

        vextractf128    $1, %ymm1, %xmm2
        vhaddpd %xmm0, %xmm0, %xmm0
        vhaddpd %xmm2, %xmm1, %xmm1
        vperm2f128      $2, %ymm0, %ymm1, %ymm0 # ymm0 = ymm0[0,1],ymm1[0,1]

-- 
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