[llvm-bugs] [Bug 28486] New: [x86, SSE] unnecessary shifts for bitwise logic with comparison (pcmp)?

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 9 11:07:17 PDT 2016


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

            Bug ID: 28486
           Summary: [x86, SSE] unnecessary shifts for bitwise logic with
                    comparison (pcmp)?
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I don't know how a <4 x i1> parameter is mapped to an XMM reg. In the larger
motivating example, the %boolvec is not a function parameter; it's a loop
value/phi, so this may not be an accurate minimization.

define <4 x i32> @bool_or(<4 x i32> %a, <4 x i32> %b, <4 x i1> %boolvec) {
  %cmp = icmp eq <4 x i32> %a, %b
  %or = or <4 x i1> %boolvec, %cmp
  %ext = sext <4 x i1> %or to <4 x i32>
  ret <4 x i32> %ext
}

$ ./llc -o - boolvec2.ll 
    pcmpeqd    %xmm1, %xmm0
    por    %xmm2, %xmm0 <--- assume %xmm2 conforms to getBooleanContents?
    pslld    $31, %xmm0   
    psrad    $31, %xmm0   <--- if so, shifts are unnecessary
    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/20160709/c6d21976/attachment-0001.html>


More information about the llvm-bugs mailing list