<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt">LLVM vectorizes this same function for floating point addition just fine (uses experimental_vector_reduce_v2_fadd), but refuses to do the same for minf(). Does anyone have any insight why that would be? I’m
using -ffast-math but that doesn’t seem to help. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">From grep’ing the sources the best I can figure is that some logic exists for Instruction::FCmp but perhaps not for Intrinsic::</span>
<span style="font-size:12.0pt">minnum. Is that the case?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">; Function Attrs: norecurse nounwind readonly<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">define float @f(float addrspace(4)* noalias nocapture readonly %a, float addrspace(4)* noalias nocapture readonly %b, float %m) local_unnamed_addr #0 {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">entry:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> br label %for.body<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">for.cond.cleanup: ; preds = %for.body<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> ret float %3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">for.body: ; preds = %entry, %for.body<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %m.addr.024 = phi float [ %m, %entry ], [ %3, %for.body ] ; [#uses=1 type=float]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %i.023 = phi i32 [ 0, %entry ], [ %inc, %for.body ] ; [#uses=3 type=i32]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %arrayidx = getelementptr inbounds float, float addrspace(4)* %a, i32 %i.023 ; [#uses=1 type=float addrspace(4)*]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %0 = load float, float addrspace(4)* %arrayidx, align 4, !tbaa !3 ; [#uses=1 type=float]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %arrayidx1 = getelementptr inbounds float, float addrspace(4)* %b, i32 %i.023 ; [#uses=1 type=float addrspace(4)*]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %1 = load float, float addrspace(4)* %arrayidx1, align 4, !tbaa !3 ; [#uses=1 type=float]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %2 = tail call fast float @llvm.minnum.f32(float %0, float %1) ; [#uses=1 type=float]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %3 = tail call fast float @llvm.minnum.f32(float %m.addr.024, float %2) ; [#uses=2 type=float]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %inc = add nuw nsw i32 %i.023, 1 ; [#uses=2 type=i32]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> %cmp = icmp ult i32 %inc, 8192 ; [#uses=1 type=i1]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !7<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">LV: Checking a loop in "f" from /path/to/x.c<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">LV: Loop hints: force=enabled width=0 unroll=0 optspace=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">LV: Found a loop: for.body<o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt">LV: Not vectorizing: Found an unidentified PHI %m.addr.024 = phi float [ %m, %entry ], [ %3, %for.body ] ; [#uses=1 type=float]<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:12.0pt">LV: Interleaving disabled by the pass manager<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">LV: Can't vectorize the instructions or CFG<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">LV: Not vectorizing: Cannot prove legality.<o:p></o:p></span></p>
</div>
</body>
</html>