[llvm-bugs] [Bug 40391] New: [X86] Use ValueTracking to convert x86-specific vector shifts to generics

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 21 05:39:09 PST 2019


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

            Bug ID: 40391
           Summary: [X86] Use ValueTracking to convert x86-specific vector
                    shifts to generics
           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: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
        Depends on: 36319

InstCombine already converts x86 vectors shifts to generic shifts for constant
shift amount cases (simplifyX86varShift + simplifyX86immShift).

For non-constant cases, ValueTracking (MaskedValueIsZero etc.) should be able
to determine when the upper bits of the shift amounts are known to be zero and
convert to generic shifts:

https://godbolt.org/z/7uik05

Similarly, if we know that any of the upper bits are NOT zero then we should be
able to convert either to zero or ashr(V, numbits-1) to match the x86 shift
behaviour.

The avx2+ per-element shifts case should be pretty straightforward, but it
requires all elements to match.

The older sse2+ uniform-element shift case is trickier as we need to correctly
value track the bottom 64-bits of the shift amount (spread across multiple
elements), [Bug #36319] would help us with this.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=36319
[Bug 36319] [ValueTracking] Add DemandedElts support to
computeKnownBits/ComputeNumSignBits
-- 
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/20190121/5aa5cce8/attachment-0001.html>


More information about the llvm-bugs mailing list