<html>
<head>
<base href="http://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 --- - llvm X86 backend generates long nop instructions for processors that don't support them"
href="http://llvm.org/bugs/show_bug.cgi?id=17792">17792</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm X86 backend generates long nop instructions for processors that don't support them
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>normal
</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>mikulas@artax.karlin.mff.cuni.cz
</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>When generating code for some 586 processors (including k6, winchip, via c3),
NOPL or NOPW instruction 0F 1F is generated. This causes crash because 586
processors don't support the NOPL and NOPW instruction.
For example, this program:
#include <stdio.h>
int main(void)
{
int i;
for (i = 0; i < 1000; i++)
printf("%d\n", i);
return 0;
}
when compiled with "clang -O2 loop.c -march=k6-2" results in this code:
08048420 <main>:
8048420: 56 push %esi
8048421: 83 ec 08 sub $0x8,%esp
8048424: 31 f6 xor %esi,%esi
8048426: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%eax,%eax,1)
804842d: 00 00 00
8048430: 89 74 24 04 mov %esi,0x4(%esp)
8048434: c7 04 24 e0 84 04 08 movl $0x80484e0,(%esp)
804843b: e8 c0 fe ff ff call 8048300 <printf@plt>
8048440: 46 inc %esi
8048441: 81 fe e8 03 00 00 cmp $0x3e8,%esi
8048447: 75 e7 jne 8048430 <main+0x10>
8048449: 31 c0 xor %eax,%eax
804844b: 83 c4 08 add $0x8,%esp
804844e: 5e pop %esi
804844f: c3 ret
The K6 processor doesn't support the nopw instruction, so the program crashes.</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>