<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 - Feature request: inline __aeabi_read_tp for ARMv7a ELF TLS"
href="https://bugs.llvm.org/show_bug.cgi?id=38394">38394</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Feature request: inline __aeabi_read_tp for ARMv7a ELF TLS
</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>Backend: ARM
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rprichard@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Clang generates a call to an __aeabi_read_tp function to access an arm32 ELF
TLS variable using the Initial-Exec or Local-Exec access models. GCC also
generates a call to this ABI function for ARMv5, but for better performance on
ARMv7, it inlines the call.
Could Clang also inline the call?
test.c:
__thread int tlsvar;
int bump() {
return ++tlsvar;
}
Clang output (clang test.c -target arm-linuxeabi -march=armv7a -Os -S):
bump:
push {r11, lr}
mov r11, sp
ldr r2, .LCPI0_0
bl __aeabi_read_tp
ldr r1, [r0, r2]
add r1, r1, #1
str r1, [r0, r2]
mov r0, r1
pop {r11, pc}
GCC output (arm-linux-gnueabi-gcc-7 test.c -march=armv5 -Os -S):
bump:
str lr, [sp, #-4]!
bl __aeabi_read_tp @ load_tp_soft
ldr r2, .L3
ldr r3, [r0, r2]
add r3, r3, #1
str r3, [r0, r2]
mov r0, r3
ldr pc, [sp], #4
GCC output (arm-linux-gnueabi-gcc-7 test.c -march=armv7-a -Os -S):
bump:
ldr r3, .L2
mrc p15, 0, r2, c13, c0, 3 @ load_tp_hard
ldr r0, [r2, r3]
add r0, r0, #1
str r0, [r2, r3]
bx lr</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>