<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 - Failure to simplify trunc(abs(sext(x))) -> abs(x)"
href="https://bugs.llvm.org/show_bug.cgi?id=48816">48816</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failure to simplify trunc(abs(sext(x))) -> abs(x)
</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>Scalar Optimizations
</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>lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, nikita.ppv@gmail.com, nunoplopes@sapo.pt, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Noticed while investigating the quality of vectorization for:
<a href="https://github.com/WojciechMula/toys/blob/master/autovectorization-tests/transform_abs.cpp">https://github.com/WojciechMula/toys/blob/master/autovectorization-tests/transform_abs.cpp</a>
(see <a href="http://0x80.pl/notesen/2021-01-18-autovectorization-gcc-clang.html">http://0x80.pl/notesen/2021-01-18-autovectorization-gcc-clang.html</a> for the
full list).
Due to promotions in the c code, for the "transform_abs_epi8" pattern we end up
with this:
%20 = load <32 x i8>, <32 x i8>* %19
%21 = sext <32 x i8> %20 to <32 x i32>
%22 = call <32 x i32> @llvm.abs.v32i32(<32 x i32> %21, i1 true)
%23 = trunc <32 x i32> %22 to <32 x i8>
<a href="https://gcc.godbolt.org/z/qoYv6s">https://gcc.godbolt.org/z/qoYv6s</a>
AFAICT we should be able to remove the sext/trunc and use a v32i8 abs as long
as we clear the "is_int_min_poison" flag:
<a href="https://alive2.llvm.org/ce/z/Fvwhka">https://alive2.llvm.org/ce/z/Fvwhka</a>
%23 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %20, i1 false)
What are the implications of clearing the poison flag as part of such a fold?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>