<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [X86] Use ValueTracking to convert x86-specific vector shifts to generics"
href="https://bugs.llvm.org/show_bug.cgi?id=40391">40391</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86] Use ValueTracking to convert x86-specific vector shifts to generics
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>Depends on</th>
<td>36319
</td>
</tr></table>
<p>
<div>
<pre>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:
<a href="https://godbolt.org/z/7uik05">https://godbolt.org/z/7uik05</a>
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), [<a class="bz_bug_link
bz_status_NEW "
title="NEW - [ValueTracking] Add DemandedElts support to computeKnownBits/ComputeNumSignBits"
href="show_bug.cgi?id=36319">Bug #36319</a>] would help us with this.</pre>
</div>
</p>
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced Bugs:</b>
<ul>
<li>
[<a class="bz_bug_link
bz_status_NEW "
title="NEW - [ValueTracking] Add DemandedElts support to computeKnownBits/ComputeNumSignBits"
href="https://bugs.llvm.org/show_bug.cgi?id=36319">Bug 36319</a>] [ValueTracking] Add DemandedElts support to computeKnownBits/ComputeNumSignBits
</li>
</ul>
</div>
<br>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>