<div dir="ltr">Hello Bevin,<br>Thanks for inputs,<br>Update: As per<i> N1169 4.1.4 (Type conversion, usual arithmetic conversions)</i><br><br><b> If one of the operands has a floating type and the other operand has a fixed-point type, the fixedpoint operand is converted to the floating type in the usual way</b> <br><br>I will implement this logic (conversion from a fixed point to floating type), and will update further changes,<br><br>Regards,<br>Nadaf.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 6, 2020 at 4:36 AM Bevin Hansson <<a href="mailto:bevin.hansson@ericsson.com">bevin.hansson@ericsson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-3766993586507782532WordSection1">
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m afraid I don’t agree with your interpretation. The spec says “<b>The rounding</b> of conversions […]
<b>is unspecified</b>”, not that the conversions themselves are.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Floating-to-fixed point conversions just aren’t implemented yet, which is why it crashes. The support is still a bit experimental. I agree that it should not crash, though.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I will leave some comments in the patch.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">/ Bevin<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b>From:</b> Gousemoodhin Nadaf <<a href="mailto:nadafgouse5@gmail.com" target="_blank">nadafgouse5@gmail.com</a>> <br>
<b>Sent:</b> July 05, 2020 9:35 PM<br>
<b>To:</b> Bevin Hansson <<a href="mailto:bevin.hansson@ericsson.com" target="_blank">bevin.hansson@ericsson.com</a>><br>
<b>Cc:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [cfe-dev] Fixed point and floating point comparision<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hello Bevin,<br>
As per N1169 4.1.4 (Type conversion, usual arithmetic conversions), conversions between the fixed point and floating point is unspecified. I believe before looking/checking for conversions, we have to handle unsupported conversions, if the conversion is not
possible, we have to return NULL.<br>
<br>
Let me know your opinions. <br>
<br>
<i>Second patch updated:</i> Changed word from <b>"Comparision" </b>to<b> "Conversion", "Conversion"</b> is correct word to describe. This verified on the local build, it does not lead to a compiler crash.<br>
<br>
Regards,<br>
Nadaf. <u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Jun 16, 2020 at 5:17 AM Bevin Hansson <<a href="mailto:bevin.hansson@ericsson.com" target="_blank">bevin.hansson@ericsson.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Hi Gousemoodhin,<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">I don't think 4.1.4 mentions anything about comparisons. The only mention of unspecified with floating point is "The rounding of conversions from a fixed-point type to a floating point type is
unspecified."<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">UsualArithmeticConversions and handleFixedPointConversion do not actually convert anything, they simply determine what the result type of the operation would be. So that would not be the place
to 'determine' unspecified-ness; that would be a property of how the computation is performed in CodeGen or constant evaluation.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">I'm assuming you are trying to implement the floating point portions of N1169. A lot of the necessary boilerplate is not in place for that, as I haven't had time to look at it much quite yet.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black">/ Bevin<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:black"><u></u> <u></u></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="gmail-m_-3766993586507782532gmail-m_-4366774860292833211divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>> on behalf of Gousemoodhin Nadaf via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Sent:</b> Saturday, June 13, 2020 6:22 AM<br>
<b>To:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [cfe-dev] Fixed point and floating point comparision</span> <u></u>
<u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Hello,<br>
When a comparison is made between the<b> fixed point and floating point</b>, the result is unspecified. Reference N1169 4.1.4 (Type conversion, usual arithmetic conversions).<br>
<br>
In code, for fixed-point number, <span style="color:black">handleFixedPointConversion()(SemaExpr.cpp) is called,
</span> I need to return unspecified.<br>
<br>
<i> <span style="color:black">handleFixedPointConversion()</span> {<br>
if ((LHS is fixed point && RHS is floating point) OR (RHS is fixed point && LHS is floating point) )<br>
return unspecified.<br>
}</i><br>
<br>
please let me know If anyone has idea, how to return unspecified or handle an unspecified case in UsualArithmeticConversions.<br>
<br>
Regards,<br>
Nadaf.<u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote></div>