<div dir="ltr"><div>I believe fpround is a node that takes a larger FP representation and rounds it to a smaller FP representation (i.e. f64 -> f32) and may or may not be known to preserve the exact value.<br><br></div>The fround node on the other had is used to actually round an FP value to the nearest whole number (note. not integer in a sense that it goes from f64 -> i64). It just rounds a floating point value to the nearest floating point whole number (i.e. f64 -> f64). I believe that for this one, the rounding mode is "Nearest away" or round to nearest whole number, ties away from zero.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 23, 2017 at 3:09 PM, Martin J. O'Riordan <span dir="ltr"><<a href="mailto:martin.oriordan@movidius.com" target="_blank">martin.oriordan@movidius.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-IE"><div class="m_-4054943953027960449WordSection1"><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634">Thanks, I have replaced these with ‘</span><span style="font-family:"Courier New";color:black">fpround</span><span style="font-family:"Book Antiqua",serif;color:#943634">’ and it does indeed work as you suggest.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634">I still see use of ‘</span><span style="font-family:"Courier New";color:black">fpround</span><span style="font-family:"Book Antiqua",serif;color:#943634">’ in the TDs for other targets AArch64, ARM, NVPTX, PowerPC and SystemZ.  Is there still a use for the old named ‘</span><span style="font-family:"Courier New";color:black">fpround</span><span style="font-family:"Book Antiqua",serif;color:#943634">’ and does it still exist with a new or refined semantic meaning, or is it just that these targets have not yet tracked the change?<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634">Certainly I am all in favour of regularising the names.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634">All the best,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634">            MartinO<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> Nemanja Ivanovic [mailto:<a href="mailto:nemanja.i.ibm@gmail.com" target="_blank">nemanja.i.ibm@gmail.<wbr>com</a>] <br><b>Sent:</b> 23 January 2017 12:42<br><b>To:</b> Martin J. O'Riordan <<a href="mailto:Martin.ORiordan@movidius.com" target="_blank">Martin.ORiordan@movidius.com</a>><br><b>Cc:</b> LLVM Developers <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [llvm-dev] Changes to TableGen in v4.0?<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><div><div><p class="MsoNormal">I believe the node you're looking for is fpround.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">That one has a type profile with the source larger than the target. The fround does not - they have to be the same.<u></u><u></u></p></div><p class="MsoNormal">I imagine this is a result of:<br>------------------------------<wbr>------------------------------<wbr>------------<br>r279129 | mkuper | 2016-08-18 15:08:15 -0500 (Thu, 18 Aug 2016) | 8 lines<br><br>[SelectionDAG] Rename fextend -> fpextend, fround -> fpround, frnd -> fround<br><br>The names of the tablegen defs now match the names of the ISD nodes.<br>This makes the world a slightly saner place, as previously "fround" matched<br>ISD::FP_ROUND and not ISD::FROUND.<br><br>Differential Revision: <a href="https://reviews.llvm.org/D23597" target="_blank">https://reviews.llvm.org/<wbr>D23597</a><br><br>------------------------------<wbr>------------------------------<wbr>------------<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Mon, Jan 23, 2017 at 12:41 PM, Martin J. O'Riordan via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">I am trying to upgrade to the LLVM v4.0 branch, but I am seeing failures in my TableGen descriptions for conversion from FP32 to FP16 (scalar and vector).</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">The patterns I have are along the lines of:</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">[(set (f16 RF16:$dst), (fround (f32 RF32:$src)))]</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">or:</span><u></u><u></u></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">[(set (v2f16 VF16:$dst), (fround (v2f32 VF32:$src)))]</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">and these now produce the errors:</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">error: In CONV_f32_f16: Type inference contradiction found, merging 'f32' into 'f16'</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">or:</span><u></u><u></u></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">error: In CONV_v2f32_v2f16: Type inference contradiction found, merging 'v2f32' into 'v2f16'</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">For the scalar version, the conflict is between two rules that have different mutually exclusive predicates (for alternative chip versions).  But in the case of the vector, the conflict is for a vector of a different size, in the case:</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">[(set (v4f16 VF16:$dst), (fround (v4f32 VF32:$src)))]</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">and ‘</span><span style="font-family:"Courier New"">CONV_v4f32_v4f16</span><span style="font-family:"Book Antiqua",serif">’.  What adjustments do I need to make to the TD descriptions to make these work again?  I know that FP16 is not hugely common on the mainstream platforms, but it is vital to ours.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">I did notice that ‘</span><span style="font-family:"Courier New"">fextend</span><span style="font-family:"Book Antiqua",serif">’ was replaced by ‘</span><span style="font-family:"Courier New"">fpextend</span><span style="font-family:"Book Antiqua",serif">’, is there some new ISD node type I should use for ‘</span><span style="font-family:"Courier New"">fround</span><span style="font-family:"Book Antiqua",serif">’?</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">Thanks,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif">            MartinO</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif"> </span><u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>______________________________<wbr>_________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></blockquote></div><br></div>