[llvm-bugs] [Bug 44694] New: [X86][AVX] Failure to combine to HADDPD

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 28 04:38:16 PST 2020


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

            Bug ID: 44694
           Summary: [X86][AVX] Failure to combine to HADDPD
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

https://godbolt.org/z/U2jZo3

#include <x86intrin.h>
__m256d add_pd(__m256d a, __m256d b) {
  return __builtin_shufflevector(a, b, -1, 2, 4, 6) +
__builtin_shufflevector(a, b, -1, 3, 5, 7);
}

define <4 x double> @_Z6add_pdDv4_dS_(<4 x double> %0, <4 x double> %1) {
  %3 = shufflevector <4 x double> %0, <4 x double> %1, <4 x i32> <i32 undef,
i32 2, i32 4, i32 6>
  %4 = shufflevector <4 x double> %0, <4 x double> %1, <4 x i32> <i32 undef,
i32 3, i32 5, i32 7>
  %5 = fadd <4 x double> %3, %4
  ret <4 x double> %5
}

_Z6add_pdDv4_dS_: # @_Z6add_pdDv4_dS_
  vperm2f128 $49, %ymm1, %ymm0, %ymm0 # ymm0 = ymm0[2,3],ymm1[2,3]
  vinsertf128 $1, %xmm1, %ymm0, %ymm1
  vunpcklpd %ymm0, %ymm1, %ymm2 # ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
  vshufpd $14, %ymm0, %ymm1, %ymm0 # ymm0 = ymm1[0],ymm0[1],ymm1[3],ymm0[3]
  vaddpd %ymm0, %ymm2, %ymm0
  retq

Which should be combine to:

  vperm2f128 $49, %ymm1, %ymm0, %ymm2 # ymm2 = ymm0[2,3],ymm1[2,3]
  vinsertf128 $1, %xmm1, %ymm0, %ymm0
  vhaddpd %ymm2, %ymm0, %ymm0
  retq

-- 
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/20200128/1a2c1794/attachment.html>


More information about the llvm-bugs mailing list