summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog21
-rw-r--r--gcc/config.gcc4
-rw-r--r--gcc/config/i386/crtprec.c57
-rw-r--r--gcc/config/i386/i386.c7
-rw-r--r--gcc/config/i386/i386.opt4
-rw-r--r--gcc/config/i386/linux.h3
-rw-r--r--gcc/config/i386/linux64.h3
-rw-r--r--gcc/config/i386/t-crtpc16
-rw-r--r--gcc/config/i386/t-linux643
-rw-r--r--gcc/doc/invoke.texi17
-rw-r--r--libgcc/ChangeLog6
-rw-r--r--libgcc/config.host8
-rw-r--r--libgcc/config/i386/t-crtpc8
13 files changed, 148 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e81b8b0c846..e9656a05abc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,22 @@
+2007-04-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config.gcc (i[34567]86-*-linux*): Add i386/t-crtpc to tm-file.
+ (x86_64-*-linux*): Ditto.
+ * config/i386/i386.opt (mpc): New option.
+ * config/i386/i386.c (overrride_options): Handle
+ ix87_precision_string.
+ * config/i386/crtprec.c: New file.
+ * config/i386/t-crtpc: Ditto.
+ * config/i386/linux.h (ENDFILE_SPEC): Add handling of -mpc32, -mpc64
+ and -mpc80 options.
+ * config/i386/linux64.h (ENDFILE_SPEC): Ditto.
+ * config/i386/t-linux64 (EXTRA_MULTILIB_PARTS): Add
+ crtprec32.o, crtprec64.o and crtprec80.o.
+
+ * doc/invoke.texi (Machine Dependent Options): Add -mpc32, -mpc64
+ and -mpc80 options.
+ (i386 and x86-64 Options): Document -mpc32, -mpc64 and -mpc80 options.
+
2007-04-02 Eric Christopher <echristo@apple.com>
* doc/invoke.texi (i386 and x86-64 Options): Document -m64
@@ -64,7 +83,7 @@
(call_value): Likewise.
2007-03-31 Wolfgang Bangerth <bangerth@dealii.org>
- Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 14737
* doc/invoke.texi: (optimization options): Reword description
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7cf32997eaa..476f7bdbd43 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1147,7 +1147,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} i386/linux.h knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} i386/linux.h kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
esac
- tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtfm t-dfprules"
+ tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules"
;;
x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h \
@@ -1156,7 +1156,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;;
x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;;
esac
- tmake_file="${tmake_file} i386/t-linux64 i386/t-crtfm t-dfprules"
+ tmake_file="${tmake_file} i386/t-linux64 i386/t-crtpc i386/t-crtfm t-dfprules"
;;
i[34567]86-*-gnu*)
;;
diff --git a/gcc/config/i386/crtprec.c b/gcc/config/i386/crtprec.c
new file mode 100644
index 00000000000..0c98b815233
--- /dev/null
+++ b/gcc/config/i386/crtprec.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 Free Software Foundation, Inc.
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * In addition to the permissions in the GNU General Public License, the
+ * Free Software Foundation gives you unlimited permission to link the
+ * compiled version of this file with other programs, and to distribute
+ * those programs without any restriction coming from the use of this
+ * file. (The General Public License restrictions do apply in other
+ * respects; for example, they cover modification of the file, and
+ * distribution when not linked into another program.)
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * As a special exception, if you link this library with files
+ * compiled with GCC to produce an executable, this does not cause
+ * the resulting executable to be covered by the GNU General Public License.
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ */
+
+#if __PREC == 32
+ #define X87CW (0 << 8) /* Single precision (24 bits) */
+#elif __PREC == 64
+ #define X87CW (2 << 8) /* Double precision (53 bits) */
+#elif __PREC == 80
+ #define X87CW (3 << 8) /* Extended precision (64 bits) */
+#else
+ #error "Wrong precision requested."
+#endif
+
+#define X87CW_PCMASK (3 << 8)
+
+static void __attribute__((constructor))
+set_precision (void)
+{
+ unsigned short int cwd;
+
+ asm volatile ("fstcw\t%0" : "=m" (cwd));
+
+ cwd &= ~X87CW_PCMASK;
+ cwd |= X87CW;
+
+ asm volatile ("fldcw\t%0" : : "m" (cwd));
+}
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7106e87eae7..a7823082443 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2095,6 +2095,13 @@ override_options (void)
ix86_tls_dialect_string);
}
+ if (ix87_precision_string)
+ {
+ i = atoi (ix87_precision_string);
+ if (i != 32 && i != 64 && i != 80)
+ error ("pc%d is not valid precision setting (32, 64 or 80)", i);
+ }
+
/* Keep nonleaf frame pointers. */
if (flag_omit_frame_pointer)
target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 7eafe4e6579..59b7bfe65ce 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -151,6 +151,10 @@ momit-leaf-frame-pointer
Target Report Mask(OMIT_LEAF_FRAME_POINTER)
Omit the frame pointer in leaf functions
+mpc
+Target RejectNegative Report Joined Var(ix87_precision_string)
+Set 80387 floating-point precision (-mpc32, -mpc64, -mpc80)
+
mpentium
Target RejectNegative Undocumented
;; Deprecated
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index 7eb2395b6d9..f0f7df600fa 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -121,6 +121,9 @@ Boston, MA 02110-1301, USA. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{mpc32:crtprec32.o%s} \
+ %{mpc64:crtprec64.o%s} \
+ %{mpc80:crtprec80.o%s} \
%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
/* A C statement (sans semicolon) to output to the stdio stream
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 2d0c7bf90f2..c6a7c88d883 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -78,6 +78,9 @@ Boston, MA 02110-1301, USA. */
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{mpc32:crtprec32.o%s} \
+ %{mpc64:crtprec64.o%s} \
+ %{mpc80:crtprec80.o%s} \
%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
#if TARGET_64BIT_DEFAULT
diff --git a/gcc/config/i386/t-crtpc b/gcc/config/i386/t-crtpc
new file mode 100644
index 00000000000..af8947bff90
--- /dev/null
+++ b/gcc/config/i386/t-crtpc
@@ -0,0 +1,16 @@
+EXTRA_PARTS += crtprec32.o crtprec64.o crtprec80.o
+
+$(T)crtprec32.o: $(srcdir)/config/i386/crtprec.c $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -D__PREC=32 -c \
+ $(srcdir)/config/i386/crtprec.c \
+ -o $(T)crtprec32$(objext)
+
+$(T)crtprec64.o: $(srcdir)/config/i386/crtprec.c $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -D__PREC=64 -c \
+ $(srcdir)/config/i386/crtprec.c \
+ -o $(T)crtprec64$(objext)
+
+$(T)crtprec80.o: $(srcdir)/config/i386/crtprec.c $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -D__PREC=80 -c \
+ $(srcdir)/config/i386/crtprec.c \
+ -o $(T)crtprec80$(objext)
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index aac59a08e36..f875126021e 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -12,7 +12,8 @@ LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o \
- crtbeginT.o crtfastmath.o
+ crtbeginT.o crtprec32.o crtprec64.o crtprec80.o \
+ crtfastmath.o
# The pushl in CTOR initialization interferes with frame pointer elimination.
# crtend*.o cannot be compiled without -fno-asynchronous-unwind-tables,
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ff42a081275..e66977af95f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -548,7 +548,7 @@ Objective-C and Objective-C++ Dialects}.
-mthreads -mno-align-stringops -minline-all-stringops @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
--mstackrealign @gol
+-mpc32 -mpc64 -mpc80 mstackrealign @gol
-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
-mcmodel=@var{code-model} @gol
-m32 -m64 -mlarge-data-threshold=@var{num}}
@@ -10018,6 +10018,21 @@ function by using the function attribute @samp{sseregparm}.
modules with the same value, including any libraries. This includes
the system libraries and startup modules.
+@item -mpc32
+@itemx -mpc64
+@itemx -mpc80
+@opindex mpc32
+@opindex mpc64
+@opindex mpc80
+
+Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
+is specified, the significand of floating-point operations is rounded to 24
+bits (single precision), @option{-mpc64} rounds the significand of
+floating-point operations to 53 bits (double precision) and @option{-mpc80}
+rounds the significand of floating-point operations to 64 bits (extended
+double precision). Note that a change of default precision control may
+affect the results returned by some of the mathematical functions.
+
@item -mstackrealign
@opindex mstackrealign
Realign the stack at entry. On the Intel x86, the
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index de59b9d56da..6b1c4b14023 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-04-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/t-crtpc: New file.
+ * config.host (i[34567]86-*-linux*): Add i386/t-crtpc to tm-file.
+ (x86_64-*-linux*): Ditto.
+
2007-02-30 Kai Tietz <kai.tietz@onevision.com>
* config.host (x86_64-*-mingw*): New target.
diff --git a/libgcc/config.host b/libgcc/config.host
index f5fff370941..3e575ab7cb6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -328,12 +328,12 @@ i[34567]86-*-openbsd*)
i[34567]86-*-coff*)
;;
i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
- extra_parts="$extra_parts crtfastmath.o"
- tmake_file="${tmake_file} i386/t-crtfm"
+ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
;;
x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
- extra_parts="$extra_parts crtfastmath.o"
- tmake_file="${tmake_file} i386/t-crtfm"
+ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
;;
i[34567]86-*-gnu*)
;;
diff --git a/libgcc/config/i386/t-crtpc b/libgcc/config/i386/t-crtpc
new file mode 100644
index 00000000000..c231ce195f2
--- /dev/null
+++ b/libgcc/config/i386/t-crtpc
@@ -0,0 +1,8 @@
+crtprec32.o: $(gcc_srcdir)/config/i386/crtprec.c
+ $(gcc_compile) -D__PREC=32 -c $<
+
+crtprec64.o: $(gcc_srcdir)/config/i386/crtprec.c
+ $(gcc_compile) -D__PREC=64 -c $<
+
+crtprec80.o: $(gcc_srcdir)/config/i386/crtprec.c
+ $(gcc_compile) -D__PREC=80 -c $<