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

            Bug ID: 50603
           Summary: Suboptimal codegen for vector pattern M < 0 ? X : Y
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

typedef int V __attribute__((vector_size(16)));

V lt_zero_x_y(V mask, V x, V y) { return mask <  0 ? x : y; }

GCC 9+ -O3 -mavx512f 
lt_zero_x_y(int __vector(4), int __vector(4), int __vector(4)):
  vblendvps xmm0, xmm2, xmm1, xmm0
  ret

LLVM  -O3 -mavx512f 
lt_zero_x_y(int __vector(4), int __vector(4), int __vector(4)):               #
@lt_zero_x_y(int __vector(4), int __vector(4), int __vector(4))
        vpcmpeqd        xmm3, xmm3, xmm3
        vpcmpgtd        k1, zmm0, zmm3
        vpblendmd       zmm0 {k1}, zmm1, zmm2
        vzeroupper
        ret


https://godbolt.org/z/W9fshMoao

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to