<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Missed optimization: `subq x, ...` and `sbbq $0, ...` not combined"
href="https://llvm.org/bugs/show_bug.cgi?id=25858">25858</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missed optimization: `subq x, ...` and `sbbq $0, ...` not combined
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>schnetter@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I see this code generated:
{{{
pushq %rbp
movq %rsp, %rbp
movq (%rsi), %rax
movq 8(%rsi), %rcx
subq 8(%rdx), %rcx
subq (%rdx), %rax
sbbq $0, %rcx
movq %rax, (%rdi)
movq %rcx, 8(%rdi)
movq %rdi, %rax
popq %rbp
retq
}}}
Note the two instructions {subq 8(%rdx), %rcx} and {sbbq $0, %rcx} -- they
could be combined to {sbbq 8(%rdx), %rcx}.
This is the bitcode that generated the instructions above:
{{{
define void @julia_-_22617(%WideUInt* sret, %WideUInt*, %WideUInt*) #0 {
top:
%3 = bitcast %WideUInt* %1 to i64*
%4 = load i64, i64* %3, align 8
%5 = bitcast %WideUInt* %2 to i64*
%6 = load i64, i64* %5, align 8
%7 = sub i64 %4, %6
%8 = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 %4, i64 %6)
%9 = extractvalue { i64, i1 } %8, 1
%10 = getelementptr inbounds %WideUInt, %WideUInt* %1, i64 0, i32 1
%11 = load i64, i64* %10, align 8
%12 = getelementptr inbounds %WideUInt, %WideUInt* %2, i64 0, i32 1
%13 = load i64, i64* %12, align 8
%14 = sub i64 %11, %13
%.neg1 = sext i1 %9 to i64
%15 = add i64 %14, %.neg1
%16 = insertvalue %WideUInt undef, i64 %7, 0
%17 = insertvalue %WideUInt %16, i64 %15, 1
store %WideUInt %17, %WideUInt* %0, align 8
ret void
}
}}}
The root of the issue is of course the duplication of the {sub} instruction and
the {llvm.usub.with.overflow} intrinsic.</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>