[cfe-dev] Fixed point and floating point comparision

Gousemoodhin Nadaf via cfe-dev cfe-dev at lists.llvm.org
Sun Aug 2 21:49:45 PDT 2020


Hello Team,
Reworked on comments, please review  https://reviews.llvm.org/D81904

Regards,
Nadaf.

On Wed, Jul 8, 2020 at 2:50 PM Gousemoodhin Nadaf <nadafgouse5 at gmail.com>
wrote:

> Hello Bevin,
> Thanks for inputs,
> Update: As per* N1169 4.1.4 (Type conversion, usual arithmetic
> conversions)*
>
> * 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*
>
> I will implement this logic (conversion from a fixed point to floating
> type), and will update further changes,
>
> Regards,
> Nadaf.
>
> On Mon, Jul 6, 2020 at 4:36 AM Bevin Hansson <bevin.hansson at ericsson.com>
> wrote:
>
>> Hi,
>>
>>
>>
>> I’m afraid I don’t agree with your interpretation. The spec says “*The
>> rounding* of conversions […] *is unspecified*”, not that the conversions
>> themselves are.
>>
>>
>>
>> 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.
>>
>>
>>
>> I will leave some comments in the patch.
>>
>>
>>
>> / Bevin
>>
>>
>>
>> *From:* Gousemoodhin Nadaf <nadafgouse5 at gmail.com>
>> *Sent:* July 05, 2020 9:35 PM
>> *To:* Bevin Hansson <bevin.hansson at ericsson.com>
>> *Cc:* cfe-dev at lists.llvm.org
>> *Subject:* Re: [cfe-dev] Fixed point and floating point comparision
>>
>>
>>
>> Hello Bevin,
>> 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.
>>
>> Let me know your opinions.
>>
>> *Second patch updated:* Changed word from *"Comparision" *to*
>> "Conversion", "Conversion"* is correct word to describe. This verified
>> on the local build, it does not lead to a compiler crash.
>>
>> Regards,
>> Nadaf.
>>
>>
>>
>> On Tue, Jun 16, 2020 at 5:17 AM Bevin Hansson <bevin.hansson at ericsson.com>
>> wrote:
>>
>> Hi Gousemoodhin,
>>
>>
>>
>> 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."
>>
>>
>>
>> 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.
>>
>>
>>
>> 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.
>>
>>
>>
>> / Bevin
>>
>>
>> ------------------------------
>>
>> *From:* cfe-dev <cfe-dev-bounces at lists.llvm.org> on behalf of
>> Gousemoodhin Nadaf via cfe-dev <cfe-dev at lists.llvm.org>
>> *Sent:* Saturday, June 13, 2020 6:22 AM
>> *To:* cfe-dev at lists.llvm.org <cfe-dev at lists.llvm.org>
>> *Subject:* [cfe-dev] Fixed point and floating point comparision
>>
>>
>>
>> Hello,
>> When a comparison is made between the* fixed point and floating point*,
>> the result is unspecified. Reference N1169 4.1.4 (Type conversion, usual
>> arithmetic conversions).
>>
>> In code, for fixed-point number, handleFixedPointConversion()(SemaExpr.cpp)
>> is called,  I need to return unspecified.
>>
>>
>>
>>
>> *   handleFixedPointConversion()  {     if ((LHS is fixed point && RHS is
>> floating point)  OR (RHS is fixed point && LHS is floating point)  )
>> return unspecified.     }*
>>
>> please let me know If anyone has idea, how to return unspecified or
>> handle an unspecified case in UsualArithmeticConversions.
>>
>> Regards,
>> Nadaf.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200803/26f06740/attachment.html>


More information about the cfe-dev mailing list