Add -mlong-double-128 and make it default for 64-bit Bionic

gcc/

	* config/i386/i386.c (flag_opts): Add -mlong-double-128.
	(ix86_option_override_internal): Default long double to 64-bit for
	32-bit Bionic and to 128-bit for 64-bit Bionic.

	* config/i386/i386.h (LONG_DOUBLE_TYPE_SIZE): Use 128 if
	TARGET_LONG_DOUBLE_128 is true.
	(LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Likewise.

	* config/i386/i386.opt (mlong-double-80): Negate -mlong-double-64.
	(mlong-double-64): Negate -mlong-double-128.
	(mlong-double-128): New option.

	* config/i386/i386-c.c (ix86_target_macros): Define
	__LONG_DOUBLE_128__ for TARGET_LONG_DOUBLE_128.

	* doc/invoke.texi: Document -mlong-double-128.

gcc/testsuite/

	* gcc.target/i386/long-double-64-1.c: Verify __multf3 isn't used.
	* gcc.target/i386/long-double-64-4.c: Likewise.
	* gcc.target/i386/long-double-80-1.c: Likewise.
	* gcc.target/i386/long-double-80-2.c: Likewise.
	* gcc.target/i386/long-double-80-3.c: Likewise.
	* gcc.target/i386/long-double-80-4.c: Likewise.
	* gcc.target/i386/long-double-80-5.c: Likewise.
	* gcc.target/i386/long-double-64-2.c: Limit to ia32.  Verify
	__multf3 isn't used.
	* gcc.target/i386/long-double-64-3.c: Likewise.
	* gcc.target/i386/long-double-128-1.c: New test.
	* gcc.target/i386/long-double-128-2.c: Likewise.
	* gcc.target/i386/long-double-128-3.c: Likewise.
	* gcc.target/i386/long-double-128-4.c: Likewise.
	* gcc.target/i386/long-double-128-5.c: Likewise.
	* gcc.target/i386/long-double-128-6.c: Likewise.
	* gcc.target/i386/long-double-128-7.c: Likewise.
	* gcc.target/i386/long-double-128-8.c: Likewise.
	* gcc.target/i386/long-double-128-9.c: Likewise.
	* gcc.target/i386/long-double-64-5.c: Likewise.
	* gcc.target/i386/long-double-64-6.c: Likewise.
	* gcc.target/i386/long-double-64-7.c: Likewise.
	* gcc.target/i386/long-double-64-8.c: Likewise.
	* gcc.target/i386/long-double-64-9.c: Likewise.
	* gcc.target/i386/long-double-80-10.c: Likewise.
	* gcc.target/i386/long-double-80-8.c: Likewise.
	* gcc.target/i386/long-double-80-9.c: Likewise.

From-SVN: r207428
This commit is contained in:
H.J. Lu 2014-02-03 15:18:44 +00:00 committed by H.J. Lu
parent f742cf901d
commit a2a1ddb57a
33 changed files with 280 additions and 10 deletions

View File

@ -1,3 +1,22 @@
2014-02-03 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (flag_opts): Add -mlong-double-128.
(ix86_option_override_internal): Default long double to 64-bit for
32-bit Bionic and to 128-bit for 64-bit Bionic.
* config/i386/i386.h (LONG_DOUBLE_TYPE_SIZE): Use 128 if
TARGET_LONG_DOUBLE_128 is true.
(LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Likewise.
* config/i386/i386.opt (mlong-double-80): Negate -mlong-double-64.
(mlong-double-64): Negate -mlong-double-128.
(mlong-double-128): New option.
* config/i386/i386-c.c (ix86_target_macros): Define
__LONG_DOUBLE_128__ for TARGET_LONG_DOUBLE_128.
* doc/invoke.texi: Document -mlong-double-128.
2014-02-03 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/60024

View File

@ -513,6 +513,9 @@ ix86_target_macros (void)
if (TARGET_LONG_DOUBLE_64)
cpp_define (parse_in, "__LONG_DOUBLE_64__");
if (TARGET_LONG_DOUBLE_128)
cpp_define (parse_in, "__LONG_DOUBLE_128__");
cpp_define_formatted (parse_in, "__ATOMIC_HLE_ACQUIRE=%d", IX86_HLE_ACQUIRE);
cpp_define_formatted (parse_in, "__ATOMIC_HLE_RELEASE=%d", IX86_HLE_RELEASE);

View File

@ -2628,6 +2628,7 @@ ix86_target_string (HOST_WIDE_INT isa, int flags, const char *arch,
static struct ix86_target_opts flag_opts[] =
{
{ "-m128bit-long-double", MASK_128BIT_LONG_DOUBLE },
{ "-mlong-double-128", MASK_LONG_DOUBLE_128 },
{ "-mlong-double-64", MASK_LONG_DOUBLE_64 },
{ "-m80387", MASK_80387 },
{ "-maccumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS },
@ -4195,10 +4196,18 @@ ix86_option_override_internal (bool main_args_p,
else if (opts_set->x_target_flags & MASK_RECIP)
opts->x_recip_mask &= ~(RECIP_MASK_ALL & ~opts->x_recip_mask_explicit);
/* Default long double to 64-bit for Bionic. */
/* Default long double to 64-bit for 32-bit Bionic and to __float128
for 64-bit Bionic. */
if (TARGET_HAS_BIONIC
&& !(opts_set->x_target_flags & MASK_LONG_DOUBLE_64))
opts->x_target_flags |= MASK_LONG_DOUBLE_64;
&& !(opts_set->x_target_flags
& (MASK_LONG_DOUBLE_64 | MASK_LONG_DOUBLE_128)))
opts->x_target_flags |= (TARGET_64BIT
? MASK_LONG_DOUBLE_128
: MASK_LONG_DOUBLE_64);
/* Only one of them can be active. */
gcc_assert ((opts->x_target_flags & MASK_LONG_DOUBLE_64) == 0
|| (opts->x_target_flags & MASK_LONG_DOUBLE_128) == 0);
/* Save the initial options in case the user does function specific
options. */

View File

@ -668,12 +668,15 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define LONG_LONG_TYPE_SIZE 64
#define FLOAT_TYPE_SIZE 32
#define DOUBLE_TYPE_SIZE 64
#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_64 ? 64 : 80)
#define LONG_DOUBLE_TYPE_SIZE \
(TARGET_LONG_DOUBLE_64 ? 64 : (TARGET_LONG_DOUBLE_128 ? 128 : 80))
/* Define this to set long double type size to use in libgcc2.c, which can
not depend on target_flags. */
#ifdef __LONG_DOUBLE_64__
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
#elif defined (__LONG_DOUBLE_128__)
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
#else
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
#endif

View File

@ -186,13 +186,17 @@ Target RejectNegative Report InverseMask(128BIT_LONG_DOUBLE) Save
sizeof(long double) is 12
mlong-double-80
Target Report RejectNegative InverseMask(LONG_DOUBLE_64) Save
Target Report RejectNegative Negative(mlong-double-64) InverseMask(LONG_DOUBLE_64) Save
Use 80-bit long double
mlong-double-64
Target Report RejectNegative Mask(LONG_DOUBLE_64) Save
Target Report RejectNegative Negative(mlong-double-128) Mask(LONG_DOUBLE_64) InverseMask(LONG_DOUBLE_128) Save
Use 64-bit long double
mlong-double-128
Target Report RejectNegative Negative(mlong-double-80) Mask(LONG_DOUBLE_128) InverseMask(LONG_DOUBLE_64) Save
Use 128-bit long double
maccumulate-outgoing-args
Target Report Mask(ACCUMULATE_OUTGOING_ARGS) Save
Reserve space for outgoing arguments in the function prologue

View File

@ -674,7 +674,7 @@ Objective-C and Objective-C++ Dialects}.
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy}
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mlong-double-64 -mlong-double-80 @gol
-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
-mregparm=@var{num} -msseregparm @gol
-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
-mpc32 -mpc64 -mpc80 -mstackrealign @gol
@ -15053,11 +15053,15 @@ with code compiled without that switch.
@item -mlong-double-64
@itemx -mlong-double-80
@itemx -mlong-double-128
@opindex mlong-double-64
@opindex mlong-double-80
@opindex mlong-double-128
These switches control the size of @code{long double} type. A size
of 64 bits makes the @code{long double} type equivalent to the @code{double}
type. This is the default for Bionic C library.
type. This is the default for 32-bit Bionic C library. A size
of 128 bits makes the @code{long double} type equivalent to the
@code{__float128} type. This is the default for 64-bit Bionic C library.
@strong{Warning:} if you override the default value for your target ABI, this
changes the size of

View File

@ -1,3 +1,33 @@
2014-02-03 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/long-double-64-1.c: Verify __multf3 isn't used.
* gcc.target/i386/long-double-64-4.c: Likewise.
* gcc.target/i386/long-double-80-1.c: Likewise.
* gcc.target/i386/long-double-80-2.c: Likewise.
* gcc.target/i386/long-double-80-3.c: Likewise.
* gcc.target/i386/long-double-80-4.c: Likewise.
* gcc.target/i386/long-double-80-5.c: Likewise.
* gcc.target/i386/long-double-64-2.c: Limit to ia32. Verify
__multf3 isn't used.
* gcc.target/i386/long-double-64-3.c: Likewise.
* gcc.target/i386/long-double-128-1.c: New test.
* gcc.target/i386/long-double-128-2.c: Likewise.
* gcc.target/i386/long-double-128-3.c: Likewise.
* gcc.target/i386/long-double-128-4.c: Likewise.
* gcc.target/i386/long-double-128-5.c: Likewise.
* gcc.target/i386/long-double-128-6.c: Likewise.
* gcc.target/i386/long-double-128-7.c: Likewise.
* gcc.target/i386/long-double-128-8.c: Likewise.
* gcc.target/i386/long-double-128-9.c: Likewise.
* gcc.target/i386/long-double-64-5.c: Likewise.
* gcc.target/i386/long-double-64-6.c: Likewise.
* gcc.target/i386/long-double-64-7.c: Likewise.
* gcc.target/i386/long-double-64-8.c: Likewise.
* gcc.target/i386/long-double-64-9.c: Likewise.
* gcc.target/i386/long-double-80-10.c: Likewise.
* gcc.target/i386/long-double-80-8.c: Likewise.
* gcc.target/i386/long-double-80-9.c: Likewise.
2014-02-03 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/57662

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-128" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-options "-O2 -mbionic" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-options "-O2 -mandroid" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-options "-O2 -mlong-double-128 -mbionic" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */
/* { dg-options "-O2 -mlong-double-128 -mandroid" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-64 -mlong-double-128" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-64" } */
__float128
foo (__float128 x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do run } */
/* { dg-options "-O0 -mlong-double-64 -mfpmath=387" } */
int
main ()
{
__float128 a = -0.23456789;
if ((double) a >= 0)
__builtin_abort ();
return 0;
}

View File

@ -0,0 +1,13 @@
/* { dg-do run } */
/* { dg-options "-O0 -mlong-double-64 -mfpmath=sse -msse2" } */
/* { dg-require-effective-target sse2 } */
#include "sse2-check.h"
static void
sse2_test (void)
{
__float128 a = -0.23456789;
if ((double) a >= 0)
__builtin_abort ();
}

View File

@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -1,4 +1,4 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-do compile { target { *-*-linux* && ia32 } } } */
/* { dg-options "-O2 -mbionic" } */
long double
@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -1,4 +1,4 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-do compile { target { *-*-linux* && ia32 } } } */
/* { dg-options "-O2 -mandroid" } */
long double
@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-128 -mlong-double-64" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-80 -mlong-double-128 -mlong-double-64" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-128 -mlong-double-80 -mlong-double-64" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-options "-O2 -mlong-double-64 -mbionic" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile { target *-*-linux* } } */
/* { dg-options "-O2 -mlong-double-64 -mandroid" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler-not "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-128 -mlong-double-64 -mlong-double-80" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -8,3 +8,4 @@ foo (long double x)
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -8,3 +8,4 @@ foo (__float80 x)
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-128 -mlong-double-80" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-double-64 -mlong-double-128 -mlong-double-80" } */
long double
foo (long double x)
{
return x * x;
}
/* { dg-final { scan-assembler "fldt" } } */
/* { dg-final { scan-assembler-not "call\[\\t \]*_?__multf3" } } */