<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 - [GlobalISel][AArch64] Calling convention for small arguments passed on stack incorrect on big-endian targets"
href="https://bugs.llvm.org/show_bug.cgi?id=35361">35361</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[GlobalISel][AArch64] Calling convention for small arguments passed on stack incorrect on big-endian targets
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>GlobalISel
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>oliver.stannard@arm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Global-isel generates incorrect code when targeting big-endian AArch64 for this
code:
int foo(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7,
int stack1) {
return stack1;
}
int main() {
int ret = foo(0,1,2,3,4,5,6,7,8);
printf("%d\n", ret);
}
Global isel thinks that the incoming value of stack1 is stored in bytes [0,4)
above SP, but for big-endian targets this should be in bytes [4,8):
// /work/llvm/build/bin/clang --target=aarch64-arm-none-eabi -march=armv8-a -c
callees.cpp -O0 -Wall -std=c++11 -mllvm -global-isel=true -mllvm
-global-isel-abort=0 -mbig-endian -o - -S
_Z3fooiiiiiiiii: // @_Z3fooiiiiiiiii
// BB#0: // %entry
sub sp, sp, #48 // =48
ldr w8, [sp, #48] // <= Should be [sp, #52]
str w0, [sp, #44]
str w1, [sp, #40]
str w2, [sp, #36]
str w3, [sp, #32]
str w4, [sp, #28]
str w5, [sp, #24]
str w6, [sp, #20]
str w7, [sp, #16]
str w8, [sp, #12]
ldr w0, [sp, #12]
add sp, sp, #48 // =48
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>