<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 - [X86] long nop generation is guarded incorrectly"
href="https://bugs.llvm.org/show_bug.cgi?id=35686">35686</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86] long nop generation is guarded incorrectly
</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>Linux
</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>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>asb@lowrisc.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The intent of the HasNopl code in X86AsmBackend seems to be that long nops
should _not_ be generated when the target CPU is "generic" or "i686" (among
others). Consider the following input (from test/MC/X86/x86_long_nop.s):
inc %eax
.p2align 5
inc %eax
This generates long nops when there is no explicit -mcpu argument, because the
empty cpu string isn't tested when setting HasNopl:
./bin/llvm-mc -filetype=obj -triple=i686-pc-linux-gnu
../test/MC/X86/x86_long_nop.s | ./bin/llvm-objdump -d -no-show-raw-insn -
<stdin>: file format ELF32-i386
Disassembly of section .text:
.text:
0: incl %eax
1: nopw %cs:(%eax,%eax)
10: nopw %cs:(%eax,%eax)
1f: nop
20: incl %eax
And short nops when explicitly passing -mcpu=generic:
./bin/llvm-mc -filetype=obj -triple=i686-pc-linux-gnu -mcpu=generic
../test/MC/X86/x86_long_nop.s | ./bin/llvm-objdump -d -no-show-raw-insn -
<stdin>: file format ELF32-i386
Disassembly of section .text:
.text:
0: incl %eax
1: nop
2: nop
3: nop
4: nop
5: nop
6: nop
7: nop
8: nop
9: nop
a: nop
b: nop
c: nop
d: nop
e: nop
f: nop
10: nop
11: nop
12: nop
13: nop
14: nop
15: nop
16: nop
17: nop
18: nop
19: nop
1a: nop
1b: nop
1c: nop
1d: nop
1e: nop
1f: nop
20: incl %eax
See also: <a href="https://reviews.llvm.org/D41349">https://reviews.llvm.org/D41349</a> which exposes this issue ensuring
that "generic" is always given as the CPU string rather than the empty string.</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>