<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 --- - AVX-512: Missed opportunity of folding masked-loads"
href="https://llvm.org/bugs/show_bug.cgi?id=31657">31657</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>AVX-512: Missed opportunity of folding masked-loads
</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>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>zvi.rackover@intel.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>For the following case:
define <16 x float> @masked_loads_add(<16 x float>* %pA, <16 x float>* %pB, <16
x float>* %pC, i16 %D) {
%Mask = bitcast i16 %D to <16 x i1>
%wide.masked.load = call <16 x float> @llvm.masked.load.v16f32.p0v16f32(<16
x float>* %pA, i32 4, <16 x i1> %Mask, <16 x float> undef)
%wide.masked.load11 = call <16 x float>
@llvm.masked.load.v16f32.p0v16f32(<16 x float>* %pB, i32 4, <16 x i1> %Mask,
<16 x float> undef)
%Add = fadd <16 x float> %wide.masked.load, %wide.masked.load11
ret <16 x float> %Add
}
llc -mcpu=skylake-avx512 generates:
kmovw %ecx, %k1
vmovups (%rdi), %zmm0 {%k1} {z}
vmovups (%rsi), %zmm1 {%k1} {z}
vaddps %zmm1, %zmm0, %zmm0
retq
We could do better if we folded the masked-load into the add:
kmovw %ecx, %k1
vmovaps (%rdi), %zmm0 {%k1} {z}
vaddps (%rsi), %zmm0, %zmm0 {%k1} {z}
retq</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>