diff mbox

[i386] define __SIZEOF_FLOAT128__

Message ID alpine.DEB.2.02.1404131525010.17253@stedding.saclay.inria.fr
State New
Headers show

Commit Message

Marc Glisse April 13, 2014, 1:31 p.m. UTC
Hello,

some people like having a macro to test if a type is available 
(__SIZEOF_INT128__ for instance). This adds macros for __float80 and 
__float128. The types seem to be always available, so I didn't add any 
condition.

If you think this is a bad idea, please close the PR.

Bootstrap+testsuite on x86_64-linux-gnu.

2014-04-13  Marc Glisse  <marc.glisse@inria.fr>

 	PR preprocessor/56540
 	* config/i386/i386-c.c (ix86_target_macros): Define
 	__SIZEOF_FLOAT80__ and __SIZEOF_FLOAT128__.

Comments

Marc Glisse April 23, 2014, 6:48 p.m. UTC | #1
(Adding an i386 maintainer in Cc)
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00620.html

On Sun, 13 Apr 2014, Marc Glisse wrote:

> Hello,
>
> some people like having a macro to test if a type is available 
> (__SIZEOF_INT128__ for instance). This adds macros for __float80 and 
> __float128. The types seem to be always available, so I didn't add any 
> condition.
>
> If you think this is a bad idea, please close the PR.
>
> Bootstrap+testsuite on x86_64-linux-gnu.
>
> 2014-04-13  Marc Glisse  <marc.glisse@inria.fr>
>
> 	PR preprocessor/56540
> 	* config/i386/i386-c.c (ix86_target_macros): Define
> 	__SIZEOF_FLOAT80__ and __SIZEOF_FLOAT128__.
H.J. Lu April 23, 2014, 7:51 p.m. UTC | #2
On Wed, Apr 23, 2014 at 11:48 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> (Adding an i386 maintainer in Cc)
> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00620.html
>
>
> On Sun, 13 Apr 2014, Marc Glisse wrote:
>
>> Hello,
>>
>> some people like having a macro to test if a type is available
>> (__SIZEOF_INT128__ for instance). This adds macros for __float80 and
>> __float128. The types seem to be always available, so I didn't add any
>> condition.
>>
>> If you think this is a bad idea, please close the PR.
>>
>> Bootstrap+testsuite on x86_64-linux-gnu.
>>
>> 2014-04-13  Marc Glisse  <marc.glisse@inria.fr>
>>
>>         PR preprocessor/56540
>>         * config/i386/i386-c.c (ix86_target_macros): Define
>>         __SIZEOF_FLOAT80__ and __SIZEOF_FLOAT128__.
>

For __SIZEOF_FLOAT80__, you should check TARGET_128BIT_LONG_DOUBLE
instead of TARGET_64BIT.
diff mbox

Patch

Index: gcc/config/i386/i386-c.c
===================================================================
--- gcc/config/i386/i386-c.c	(revision 209345)
+++ gcc/config/i386/i386-c.c	(working copy)
@@ -511,20 +511,27 @@  ix86_target_macros (void)
 
   if (!TARGET_80387)
     cpp_define (parse_in, "_SOFT_FLOAT");
 
   if (TARGET_LONG_DOUBLE_64)
     cpp_define (parse_in, "__LONG_DOUBLE_64__");
 
   if (TARGET_LONG_DOUBLE_128)
     cpp_define (parse_in, "__LONG_DOUBLE_128__");
 
+  if (TARGET_64BIT)
+    cpp_define (parse_in, "__SIZEOF_FLOAT80__=16");
+  else
+    cpp_define (parse_in, "__SIZEOF_FLOAT80__=12");
+
+  cpp_define (parse_in, "__SIZEOF_FLOAT128__=16");
+
   cpp_define_formatted (parse_in, "__ATOMIC_HLE_ACQUIRE=%d", IX86_HLE_ACQUIRE);
   cpp_define_formatted (parse_in, "__ATOMIC_HLE_RELEASE=%d", IX86_HLE_RELEASE);
 
   ix86_target_macros_internal (ix86_isa_flags,
 			       ix86_arch,
 			       ix86_tune,
 			       ix86_fpmath,
 			       cpp_define);
 }