<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 - Suboptimal codegen for "fast" minnum and maxnum"
href="https://bugs.llvm.org/show_bug.cgi?id=34149">34149</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Suboptimal codegen for "fast" minnum and maxnum
</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>All
</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: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sanjoy@playingwithpointers.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>On trunk, llc -O3 -mcpu=haswell on this program:
define <4 x double> @via_minnum(<4 x double> %x, <4 x double> %y) {
%z = call fast <4 x double> @llvm.minnum.v4f64(<4 x double> %x, <4 x double>
%y) readnone
ret <4 x double> %z
}
define <4 x double> @via_fcmp(<4 x double> %x, <4 x double> %y) {
%c = fcmp ule <4 x double> %x, %y
%z = select <4 x i1> %c, <4 x double> %x, <4 x double> %y
ret <4 x double> %z
}
declare <4 x double> @llvm.minnum.v4f64(<4 x double>, <4 x double>)
generates:
.text
.file "fast-min.ll"
.globl via_minnum # -- Begin function via_minnum
.p2align 4, 0x90
.type via_minnum,@function
via_minnum: # @via_minnum
.cfi_startproc
# BB#0:
vminpd %ymm0, %ymm1, %ymm2
vcmpunordpd %ymm0, %ymm0, %ymm0
vblendvpd %ymm0, %ymm1, %ymm2, %ymm0
retq
.Lfunc_end0:
.size via_minnum, .Lfunc_end0-via_minnum
.cfi_endproc
# -- End function
.globl via_fcmp # -- Begin function via_fcmp
.p2align 4, 0x90
.type via_fcmp,@function
via_fcmp: # @via_fcmp
.cfi_startproc
# BB#0:
vminpd %ymm0, %ymm1, %ymm0
retq
.Lfunc_end1:
.size via_fcmp, .Lfunc_end1-via_fcmp
.cfi_endproc
# -- End function
.section ".note.GNU-stack","",@progbits
Ideally we should be able to exploit the "fast" attribute on the minnum call to
generate the same assembly for @via_minnum as we do for @via_fcmp</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>