aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.7
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2012-10-09 12:52:14 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2012-10-09 12:52:14 +0800
commit163b750d6d294bf3f2dcdaeb6f020bef1c55aafb (patch)
tree7bbb22d70bceeb53c2ebefbaa135da4cc86514c1 /gcc-4.7
parent3800bda255b20023e993ed786674f70c909d60b5 (diff)
downloadtoolchain_gcc-163b750d6d294bf3f2dcdaeb6f020bef1c55aafb.tar.gz
toolchain_gcc-163b750d6d294bf3f2dcdaeb6f020bef1c55aafb.tar.bz2
toolchain_gcc-163b750d6d294bf3f2dcdaeb6f020bef1c55aafb.zip
[4.7] 64-bit long double for bionic
See Related CL 65cadbba7f7e816b4b2bff752808b7429d0d0f2a done to GCC 4.6 Change-Id: Ia2da804331e82e47f62925a8e9ab819507501fc9
Diffstat (limited to 'gcc-4.7')
-rw-r--r--gcc-4.7/gcc/config/i386/i386-c.c3
-rw-r--r--gcc-4.7/gcc/config/i386/i386.c10
-rw-r--r--gcc-4.7/gcc/config/i386/i386.h12
-rw-r--r--gcc-4.7/gcc/config/i386/i386.opt8
-rw-r--r--gcc-4.7/gcc/doc/invoke.texi22
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-1.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-2.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-3.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-4.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-1.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-2.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-3.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-4.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-5.c10
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-6.c11
-rw-r--r--gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-7.c13
-rw-r--r--gcc-4.7/libgcc/config/i386/t-linux1
17 files changed, 161 insertions, 9 deletions
diff --git a/gcc-4.7/gcc/config/i386/i386-c.c b/gcc-4.7/gcc/config/i386/i386-c.c
index 62772b778..8fb3b3187 100644
--- a/gcc-4.7/gcc/config/i386/i386-c.c
+++ b/gcc-4.7/gcc/config/i386/i386-c.c
@@ -394,6 +394,9 @@ ix86_target_macros (void)
builtin_define_std ("i386");
}
+ if (TARGET_LONG_DOUBLE_64)
+ cpp_define (parse_in, "__LONG_DOUBLE_64__");
+
ix86_target_macros_internal (ix86_isa_flags,
ix86_arch,
ix86_tune,
diff --git a/gcc-4.7/gcc/config/i386/i386.c b/gcc-4.7/gcc/config/i386/i386.c
index c2c6cd02c..adf911c64 100644
--- a/gcc-4.7/gcc/config/i386/i386.c
+++ b/gcc-4.7/gcc/config/i386/i386.c
@@ -2692,6 +2692,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-64", MASK_LONG_DOUBLE_64 },
{ "-m80387", MASK_80387 },
{ "-maccumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS },
{ "-malign-double", MASK_ALIGN_DOUBLE },
@@ -3802,6 +3803,11 @@ ix86_option_override_internal (bool main_args_p)
#endif
}
+ /* Default long double to 64-bit for Bionic. */
+ if (TARGET_HAS_BIONIC
+ && !(target_flags_explicit & MASK_LONG_DOUBLE_64))
+ target_flags |= MASK_LONG_DOUBLE_64;
+
if (TARGET_AVX)
{
/* When not optimize for size, enable vzeroupper optimization for
@@ -20479,7 +20485,9 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode)
parts[2] = gen_int_mode (l[2], SImode);
break;
case XFmode:
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
+ /* We can't use REAL_VALUE_TO_TARGET_LONG_DOUBLE since
+ long double may not be 80-bit. */
+ real_to_target (l, &r, mode);
parts[2] = gen_int_mode (l[2], SImode);
break;
case DFmode:
diff --git a/gcc-4.7/gcc/config/i386/i386.h b/gcc-4.7/gcc/config/i386/i386.h
index 3a49803dc..84a7da573 100644
--- a/gcc-4.7/gcc/config/i386/i386.h
+++ b/gcc-4.7/gcc/config/i386/i386.h
@@ -663,9 +663,17 @@ enum target_cpu_default
#define LONG_LONG_TYPE_SIZE 64
#define FLOAT_TYPE_SIZE 32
#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 80
+#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_64 ? 64 : 80)
-#define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
+/* 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
+#else
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
+#endif
+
+#define WIDEST_HARDWARE_FP_SIZE 80
#if defined (TARGET_BI_ARCH) || TARGET_64BIT_DEFAULT
#define MAX_BITS_PER_WORD 64
diff --git a/gcc-4.7/gcc/config/i386/i386.opt b/gcc-4.7/gcc/config/i386/i386.opt
index 6c516e7b8..4008fd0fe 100644
--- a/gcc-4.7/gcc/config/i386/i386.opt
+++ b/gcc-4.7/gcc/config/i386/i386.opt
@@ -86,6 +86,14 @@ m96bit-long-double
Target RejectNegative Report InverseMask(128BIT_LONG_DOUBLE) Save
sizeof(long double) is 12
+mlong-double-80
+Target Report RejectNegative InverseMask(LONG_DOUBLE_64) Save
+Use 80-bit long double
+
+mlong-double-64
+Target Report RejectNegative Mask(LONG_DOUBLE_64) Save
+Use 64-bit long double
+
maccumulate-outgoing-args
Target Report Mask(ACCUMULATE_OUTGOING_ARGS) Save
Reserve space for outgoing arguments in the function prologue
diff --git a/gcc-4.7/gcc/doc/invoke.texi b/gcc-4.7/gcc/doc/invoke.texi
index 8fcebf3a8..8c08573cb 100644
--- a/gcc-4.7/gcc/doc/invoke.texi
+++ b/gcc-4.7/gcc/doc/invoke.texi
@@ -633,7 +633,8 @@ Objective-C and Objective-C++ Dialects}.
-mbmi2 -mlwp -mthreads -mno-align-stringops -minline-all-stringops @gol
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
--m96bit-long-double -mregparm=@var{num} -msseregparm @gol
+-m96bit-long-double -mlong-double-64 -mlong-double-80 @gol
+-mregparm=@var{num} -msseregparm @gol
-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
-mpc32 -mpc64 -mpc80 -mstackrealign @gol
-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
@@ -13437,11 +13438,20 @@ its ABI specifies that @code{long double} is to be aligned on 16-byte boundary.
Notice that neither of these options enable any extra precision over the x87
standard of 80 bits for a @code{long double}.
-@strong{Warning:} if you override the default value for your target ABI, the
-structures and arrays containing @code{long double} variables will change
-their size as well as function calling convention for function taking
-@code{long double} will be modified. Hence they will not be binary
-compatible with arrays or structures in code compiled without that switch.
+@item -mlong-double-64
+@itemx -mlong-double-80
+@opindex mlong-double-64
+@opindex mlong-double-80
+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.
+
+@strong{Warning:} if you override the default value for your target ABI, this
+changes the size of
+structures and arrays containing @code{long double} variables,
+as well as modifying the function calling convention for functions taking
+@code{long double}. Hence they are not binary-compatible
+with code compiled without that switch.
@item -mlarge-data-threshold=@var{number}
@opindex mlarge-data-threshold=@var{number}
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-1.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-1.c
new file mode 100644
index 000000000..cf933796f
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-64" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-2.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-2.c
new file mode 100644
index 000000000..ddf4fe656
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mbionic" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-3.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-3.c
new file mode 100644
index 000000000..e748fab2e
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mandroid" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-4.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-4.c
new file mode 100644
index 000000000..d9c25aaec
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-64-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-80 -mlong-double-64" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-1.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-1.c
new file mode 100644
index 000000000..d3b75a0be
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-80" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-2.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-2.c
new file mode 100644
index 000000000..954dfd15d
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mlong-double-80 -mbionic" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-3.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-3.c
new file mode 100644
index 000000000..e0e8365e3
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mlong-double-80 -mandroid" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-4.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-4.c
new file mode 100644
index 000000000..cac2d55bc
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-64 -mlong-double-80" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-5.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-5.c
new file mode 100644
index 000000000..4aa606fd1
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-5.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-64" } */
+
+__float80
+foo (__float80 x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-6.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-6.c
new file mode 100644
index 000000000..a395a2659
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-6.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options "-O0 -mlong-double-64 -mfpmath=387" } */
+
+int
+main ()
+{
+ __float80 a = -0.23456789;
+ if ((double) a >= 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-7.c b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-7.c
new file mode 100644
index 000000000..9b30fe885
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/gcc.target/i386/long-double-80-7.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-O0 -mlong-double-64 -mfpmath=sse" } */
+/* { dg-require-effective-target sse2 } */
+
+#include "sse2-check.h"
+
+static void
+sse2_test (void)
+{
+ __float80 a = -0.23456789;
+ if ((double) a >= 0)
+ __builtin_abort ();
+}
diff --git a/gcc-4.7/libgcc/config/i386/t-linux b/gcc-4.7/libgcc/config/i386/t-linux
index 29b4c2239..f81a3003b 100644
--- a/gcc-4.7/libgcc/config/i386/t-linux
+++ b/gcc-4.7/libgcc/config/i386/t-linux
@@ -2,3 +2,4 @@
# Need to support TImode for x86. Override the settings from
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
+HOST_LIBGCC2_CFLAGS += -mlong-double-80