[llvm-bugs] [Bug 50392] New: Compiler no longer producing single horizontal add instruction after ab2c499d

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 18 10:38:24 PDT 2021


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: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: htmldeveloper at gmail.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210518/85eaac0f/attachment.html>


More information about the llvm-bugs mailing list