[cfe-dev] Fixed point and floating point comparision

Bevin Hansson via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 16 02:17:02 PDT 2020


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/20200616/3da976e1/attachment-0001.html>


More information about the cfe-dev mailing list