[llvm-bugs] [Bug 38814] New: [X86][SSE] BLENDV Simplification to AND/ANDN

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 3 09:04:25 PDT 2018


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

            Bug ID: 38814
           Summary: [X86][SSE] BLENDV Simplification to AND/ANDN
           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: andrea.dibiagio at gmail.com, craig.topper at gmail.com,
                    llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com

In cases where the _mm_blendv_* intrinsics are used with zero/allbits
true/false operands it'd be better to simplify to and/andnot bit operations if
we know the select operand is 'all sign bits'.

This might be even worth it for any true/false operands but we sometimes fail
to convert this back to VSELECT.

https://gcc.godbolt.org/z/K_7Zd9

__m128 sel_v4f32(__m128 *x, __m128 y, __m128 z) {
    return _mm_blendv_ps(*x, _mm_setzero_ps(), _mm_cmpgt_ps(y, z));
}

_Z9sel_v4f32PDv4_fS_S_:
  vmovaps (%rdi), %xmm2
  vcmpltps %xmm0, %xmm1, %xmm0
  vxorps %xmm1, %xmm1, %xmm1
  vblendvps %xmm0, %xmm1, %xmm2, %xmm0
  retq

But could be just vcmpps + vandps/vandnps, allowing further combines,
commutation etc.

-- 
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/20180903/c1e9a6e8/attachment.html>


More information about the llvm-bugs mailing list