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: unassignedb...@nondot.org
          Reporter: wolfgang_p...@playstation.sony.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to