[PATCH] D15120: Add support for __float128 type to be used by targets that support it

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 15:49:51 PST 2016


hubert.reinterpretcast added a comment.

In http://reviews.llvm.org/D15120#340515, @nemanjai wrote:

> If the reviewers don't mind, I would like to keep this patch with diagnostics for interoperability between the two types for now. This is simply because enabling such interoperability requires changes to some of the conversion infrastructure (i.e. allowing FPTrunc/FPExt for types of the same width, etc.). This is to prevent crashes on code such as:
>
>   __float128 foo(long double d) {
>     return d;
>   }
>   
>
> A test case like that will trip asserts when attempting to generate code. Of course, this is easy to fix (3 minor changes in 2 files) but even if we emit that IR, the back end will fail when trying to compile it.
>  What I meant to do with this patch is to just get the Clang support in and emit diagnostics for things that the target isn't able to do yet. I will follow this up with a patch that will:
>
> 1. Remove the diagnostics
> 2. Allow the conversions
> 3. Provide libcalls for the necessary operations (similarly to what GCC does)


This sounds good to me. @rjmccall @rsmith, are we good to move forward with this first patch?


================
Comment at: lib/Sema/SemaExpr.cpp:1156
@@ +1155,3 @@
+
+  QualType LHSElemType = dyn_cast<ComplexType>(LHSType) ?
+    cast<ComplexType>(LHSType)->getElementType() : LHSType;
----------------
The result of the `dyn_cast` can be saved instead of using `cast` after the `dyn_cast`.


Repository:
  rL LLVM

http://reviews.llvm.org/D15120





More information about the cfe-commits mailing list