[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
Thu Dec 10 15:26:26 PST 2015
hubert.reinterpretcast added a comment.
I would like to see a test:
__float128 qf();
long double ldf();
long double ld{qf()}; // error: narrowing
__float128 q{ldf()}; // passes
================
Comment at: include/clang/Basic/TargetInfo.h:384
@@ +383,3 @@
+ unsigned getFloat128Width() const { return 128; }
+ unsigned getFloat128Align() const { return 128; }
+ const llvm::fltSemantics &getFloat128Format() const {
----------------
This should probably not be hard-coded. On s390x-ibm-linux-gnu, the IEEE 128-bit binary format type has 8 byte alignment (not 16).
================
Comment at: lib/CodeGen/CGDebugInfo.cpp:539
@@ -538,2 +538,3 @@
case BuiltinType::LongDouble:
+ case BuiltinType::Float128:
case BuiltinType::Double:
----------------
Is a PPCDoubleDouble "long double" and "__float128" distinguishable on PPC given this DWARF treatment?
================
Comment at: lib/Lex/LiteralSupport.cpp:604
@@ -596,3 +603,3 @@
if (isLong || isLongLong) break; // Cannot be repeated.
- if (isFloat) break; // LF invalid.
+ if (isFloat || isFloat128) break; // LF, QL invalid.
----------------
minor: should the comment have FL instead of LF?
================
Comment at: lib/Sema/SemaOverload.cpp:1921-1922
@@ -1920,4 +1920,4 @@
// C99 6.3.1.5p1:
// When a float is promoted to double or long double, or a
// double is promoted to long double [...].
if (!getLangOpts().CPlusPlus &&
----------------
In C99 6.3.1.5p1:
> [...] its value is unchanged.
Allowing `long double` to promote to `__float128` violates that on at least one target platform.
For example, PPCDoubleDouble can represent (2^512) - 1 exactly.
Repository:
rL LLVM
http://reviews.llvm.org/D15120
More information about the cfe-commits
mailing list