<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:david.bolvansky@gmail.com" title="David Bolvansky <david.bolvansky@gmail.com>"> <span class="fn">David Bolvansky</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Missed small switch optimizations"
href="https://bugs.llvm.org/show_bug.cgi?id=37368">bug 37368</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Missed small switch optimizations"
href="https://bugs.llvm.org/show_bug.cgi?id=37368#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Missed small switch optimizations"
href="https://bugs.llvm.org/show_bug.cgi?id=37368">bug 37368</a>
from <span class="vcard"><a class="email" href="mailto:david.bolvansky@gmail.com" title="David Bolvansky <david.bolvansky@gmail.com>"> <span class="fn">David Bolvansky</span></a>
</span></b>
<pre>Clang ignores likely hints?
#define likely(x) __builtin_expect((x),1)
// switch like
char * b(int e) {
if (likely(e == 0))
return "0";
else if (e == 1)
return "1";
else return "f";
}
Clang:
b: # @b
cmp edi, 1
mov eax, offset .L.str.1
mov ecx, offset .L.str.2
cmove rcx, rax
test edi, edi
mov eax, offset .L.str
cmovne rax, rcx
ret
GCC:
b:
mov eax, OFFSET FLAT:.LC0
test edi, edi
jne .L7
ret
.L7:
cmp edi, 1
mov edx, OFFSET FLAT:.LC2
mov eax, OFFSET FLAT:.LC1
cmovne rax, rdx
ret</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>