<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 - noalias/restrict on global pointers"
href="https://bugs.llvm.org/show_bug.cgi?id=47575">47575</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>noalias/restrict on global pointers
</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>Windows NT
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.bolvansky@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>float * __restrict__ x;
float * __restrict__ y;
float * __restrict__ z;
void foo (float * __restrict__ xx, float * __restrict__ yy)
{
float * __restrict__ pin = &xx[0];
float * __restrict__ pout =&yy[0];
*pout++ = *pin++;
*pout++ = *pin++;
*pout++ = *pin++;
*pout++ = *pin++;
}
void bar ()
{
float * __restrict__ pin = &x[0];
float * __restrict__ pout =&y[0];
*pout++ = *pin++;
*pout++ = *pin++;
*pout++ = *pin++;
*pout++ = *pin++;
}
void loop() {
for (int i=0;i < 4;++i) x[i]=y[i]+z[i];
}
Clang -O3 -mavx2:
foo(float*, float*): # @foo(float*, float*)
vmovups xmm0, xmmword ptr [rdi]
vmovups xmmword ptr [rsi], xmm0
ret
bar(): # @bar()
mov rax, qword ptr [rip + x]
mov rcx, qword ptr [rip + y]
mov edx, dword ptr [rax]
mov dword ptr [rcx], edx
mov edx, dword ptr [rax + 4]
mov dword ptr [rcx + 4], edx
mov edx, dword ptr [rax + 8]
mov dword ptr [rcx + 8], edx
mov eax, dword ptr [rax + 12]
mov dword ptr [rcx + 12], eax
ret
loop(): # @loop()
mov rax, qword ptr [rip + y]
mov rcx, qword ptr [rip + z]
mov rdx, qword ptr [rip + x]
vmovss xmm0, dword ptr [rax] # xmm0 = mem[0],zero,zero,zero
vaddss xmm0, xmm0, dword ptr [rcx]
vmovss dword ptr [rdx], xmm0
vmovss xmm0, dword ptr [rax + 4] # xmm0 = mem[0],zero,zero,zero
vaddss xmm0, xmm0, dword ptr [rcx + 4]
vmovss dword ptr [rdx + 4], xmm0
vmovss xmm0, dword ptr [rax + 8] # xmm0 = mem[0],zero,zero,zero
vaddss xmm0, xmm0, dword ptr [rcx + 8]
vmovss dword ptr [rdx + 8], xmm0
vmovss xmm0, dword ptr [rax + 12] # xmm0 = mem[0],zero,zero,zero
vaddss xmm0, xmm0, dword ptr [rcx + 12]
vmovss dword ptr [rdx + 12], xmm0
ret
GCC:
foo(float*, float*):
vmovups xmm0, XMMWORD PTR [rdi]
vmovups XMMWORD PTR [rsi], xmm0
ret
bar():
mov rax, QWORD PTR x[rip]
vmovups xmm0, XMMWORD PTR [rax]
mov rax, QWORD PTR y[rip]
vmovups XMMWORD PTR [rax], xmm0
ret
loop():
mov rax, QWORD PTR y[rip]
vmovups xmm0, XMMWORD PTR [rax]
mov rax, QWORD PTR z[rip]
vaddps xmm0, xmm0, XMMWORD PTR [rax]
mov rax, QWORD PTR x[rip]
vmovups XMMWORD PTR [rax], xmm0
ret
<a href="https://gcc.godbolt.org/z/dPsv17">https://gcc.godbolt.org/z/dPsv17</a></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>