<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 - Legalize integer divisions with enough signbits as a smaller operation"
href="https://bugs.llvm.org/show_bug.cgi?id=45668">45668</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Legalize integer divisions with enough signbits as a smaller operation
</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>Common Code Generator Code
</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>erich.keane@intel.com, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, nikita.ppv@gmail.com, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Split off from [<a class="bz_bug_link
bz_status_NEW "
title="NEW - Integer division of types larger than 128-bits reports a fatal error in the DAG legalizer"
href="show_bug.cgi?id=45649">Bug #45649</a>]:
We don't have much support for arbitrary sized integer division, and once we
can't legalize to a wider type it does tend to fail - I'm not sure if this is
likely to change anytime soon.
We don't even handle the likes of:
define i129 @div_i31_sext_i129(i31 %0, i31 %1) {
%3 = sext i31 %0 to i129
%4 = sext i31 %1 to i129
%5 = sdiv i129 %3, %4
ret i129 %5
}
I may be wrong here but we should be able to legalize to:
define i129 @div_i31_sext_i129(i31 %0, i31 %1) {
%3 = sext i31 %0 to i64
%4 = sext i31 %1 to i64
%5 = sdiv i64 %3, %4
%6 = sext i64 %5 to i129
ret i129 %6
}
Alive2 (with smaller types): <a href="http://volta.cs.utah.edu:8080/z/FtCZCa">http://volta.cs.utah.edu:8080/z/FtCZCa</a>
----------------------------------------
define i19 @src(i7 %0, i7 %1) {
%2:
%3 = sext i7 %0 to i19
%4 = sext i7 %1 to i19
%5 = sdiv i19 %3, %4
ret i19 %5
}
=>
define i19 @tgt(i7 %0, i7 %1) {
%2:
%3 = sext i7 %0 to i16
%4 = sext i7 %1 to i16
%5 = sdiv i16 %3, %4
%6 = sext i16 %5 to i19
ret i19 %6
}
Transformation seems to be correct!</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>