<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 --- - [ppc] bad scheduling for special register access instructions"
href="https://llvm.org/bugs/show_bug.cgi?id=25685">25685</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ppc] bad scheduling for special register access instructions
</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: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>carrot@google.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>This is a very common instruction sequence.
One example is Perl_sv_setsv_flags from perlbench. On power8, llvm generated
Perl_sv_setsv_flags consumes 4.26% of run time, gcc generated function consumes
3.5% of run time.
perf annotate shows following instructions and cycles of llvm generated code:
│ 00000000100c67d0 <Perl_sv_setsv_flags>:
│ addis r2,r12,26
│ addi r2,r2,31576
4.95 │ mfcr r12
4.18 │ mflr r0
0.07 │ std r31,-8(r1)
│ std r0,16(r1)
0.02 │ stw r12,8(r1)
...
The two instructions mfcr/mflr consume many time, these are slow instructions,
but the results are used immediately, causes stalling.
For comparison following is gcc generated code:
│ 00000000100d02f0 <Perl_sv_setsv_flags>:
│ addis r2,r12,24
│ addi r2,r2,21112
1.63 │ mflr r0
│ cmpld cr7,r4,r3
1.57 │ std r30,-16(r1)
0.01 │ std r31,-8(r1)
1.66 │ mfocrf r12,8
│ std r26,-48(r1)
│ std r27,-40(r1)
0.02 │ mr r31,r3
│ mr r30,r4
│ std r28,-32(r1)
2.64 │ std r29,-24(r1)
│ stw r12,8(r1)
│ std r0,16(r1)
...
It has much better scheduling of mflr/mfocrf and corresponding usage
instructions.</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>