<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 --- - Less efficient encoding of shl using direct object emission"
href="https://llvm.org/bugs/show_bug.cgi?id=23098">23098</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Less efficient encoding of shl using direct object emission
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>MC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>russell_gallop@sn.scee.net
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>For the following source a less efficient instruction encoding is generated for
direct object emission than outputting asm (with -via-file-asm). Using r232944.
This is the case as -O0/-O1/-O2/-O3.
$ cat test.c
int a;
void fn1() { a = a << 1 & 255; }
$ clang -c test.c -O3 -o test.o && objdump -d test.o
test.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <fn1>:
0: 8b 05 00 00 00 00 mov 0x0(%rip),%eax # 6 <fn1+0x6>
6: 83 e0 7f and $0x7f,%eax
9: c1 e0 01 shl $0x1,%eax
c: 89 05 00 00 00 00 mov %eax,0x0(%rip) # 12 <fn1+0x12>
12: c3 retq
$ clang -c test.c -O3 -via-file-asm -o tests.o && objdump -d tests.o
tests.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <fn1>:
0: 8b 05 00 00 00 00 mov 0x0(%rip),%eax # 6 <fn1+0x6>
6: 83 e0 7f and $0x7f,%eax
9: d1 e0 shl %eax
b: 89 05 00 00 00 00 mov %eax,0x0(%rip) # 11 <fn1+0x11>
11: c3 retq</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>