[llvm-bugs] [Bug 45747] New: [VectorCombine] Generated code no longer uses horizontal add/sub

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 29 16:17:06 PDT 2020


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

            Bug ID: 45747
           Summary: [VectorCombine] Generated code no longer uses
                    horizontal add/sub
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: Wolfgang_Pieb at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org

After
https://github.com/llvm/llvm-project/commit/a69158c12acd635ee4bcb22b1060d92b29483042
the following test cases no longer generate horizontal add/sub for the
following test cases:
==========================================================================
typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));

__m128 add_ps_002(__m128 a, __m128 b) {
  __m128 r = (__m128){ a[0] + a[1], a[2] + a[3], b[0] + b[1], b[2] + b[3] };
  return __builtin_shufflevector(r, a, -1, 1, -1, -1);
}

__m128 add_ps_013(__m128 a, __m128 b) {
  __m128 r = (__m128){ a[0] + a[1], a[2] + a[3], b[0] + b[1], b[2] + b[3] };
  return __builtin_shufflevector(r, a, 3, -1, -1, -1);
}
==========================================================================
The diffs (old code first):

<       vhaddps %xmm0, %xmm0, %xmm0
<       vmovshdup       %xmm0, %xmm0    # xmm0 = xmm0[1,1,3,3]
---
>       vmovshdup       %xmm0, %xmm1    # xmm1 = xmm0[1,1,3,3]
>       vaddps  %xmm0, %xmm1, %xmm0
>       vpermilps       $232, %xmm0, %xmm0 # xmm0 = xmm0[0,2,2,3]
24,25c25,27
<       vhaddps %xmm1, %xmm1, %xmm0
<       vmovshdup       %xmm0, %xmm0    # xmm0 = xmm0[1,1,3,3]
---
>       vmovshdup       %xmm1, %xmm0    # xmm0 = xmm1[1,1,3,3]
>       vaddps  %xmm1, %xmm0, %xmm0
>       vpermilpd       $1, %xmm0, %xmm0 # xmm0 = xmm0[1,0]

-- 
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/20200429/fdba78c9/attachment.html>


More information about the llvm-bugs mailing list