diff mbox

PATCH: Backport --with-fpmath=sse to ix86/gcc-4_4-branch

Message ID 20100814014510.GA2987@intel.com
State New
Headers show

Commit Message

H.J. Lu Aug. 14, 2010, 1:45 a.m. UTC
Hi,

This patch backports --with-fpmath=sse to ix86/gcc-4_4-branch.


H.J.
---
gcc/

2010-08-13  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline
	2010-02-26  H.J. Lu  <hongjiu.lu@intel.com>

	* config.gcc: Support --with-fpmath=sse for x86.

	* config/i386/ssemath.h: New.

	* doc/install.texi (--with-fpmath=sse): Documented.

gcc/testsuite/

2010-08-13  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline
	2010-02-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR testsuite/37074:
	* gcc.dg/torture/stackalign/stackalign.exp: Add -mno-mmx to x86.
diff mbox

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9027287..8a92e22 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2619,6 +2619,27 @@  if test x$with_cpu = x ; then
   esac
 fi
 
+# Support --with-fpmath.
+if test x$with_fpmath != x; then
+  case ${target} in
+    i[34567]86-*-* | x86_64-*-*)
+      case ${with_fpmath} in
+      sse)
+	tm_file="${tm_file} i386/ssemath.h"
+	;;
+      *)
+	echo "Invalid --with-fpmath=$with_fpmath" 1>&2
+	exit 1
+	;;
+      esac
+      ;;
+    *)
+      echo "--with-fpmath isn't supported for $target." 1>&2
+      exit 1
+      ;;
+  esac
+fi
+
 # Similarly for --with-schedule.
 if test x$with_schedule = x; then
 	case ${target} in
diff --git a/gcc/config/i386/ssemath.h b/gcc/config/i386/ssemath.h
new file mode 100644
index 0000000..357d6a3
--- /dev/null
+++ b/gcc/config/i386/ssemath.h
@@ -0,0 +1,25 @@ 
+/* Copyright (C) 2010
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#undef TARGET_FPMATH_DEFAULT
+#define TARGET_FPMATH_DEFAULT (TARGET_SSE2 ? FPMATH_SSE : FPMATH_387)
+
+#undef TARGET_SUBTARGET32_ISA_DEFAULT
+#define TARGET_SUBTARGET32_ISA_DEFAULT \
+   (OPTION_MASK_ISA_MMX | OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_SSE2)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 44b609d..3461e9b 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1088,6 +1088,11 @@  of the arguments depend on the target.
 Specify if the compiler should default to @option{-marm} or @option{-mthumb}.
 This option is only supported on ARM targets.
 
+@item --with-fpmath=sse
+Specify if the compiler should default to @option{-msse2} and
+@option{-mfpmath=sse}.  This option is only supported on i386 and
+x86-64 targets.
+
 @item --with-divide=@var{type}
 Specify how the compiler should generate code for checking for
 division by zero.  This option is only supported on the MIPS target.
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp b/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
index 3574e4d..ef45dbe 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/stackalign.exp
@@ -28,6 +28,7 @@  set additional_flags ""
 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
     lappend additional_flags "-mstackrealign"
     lappend additional_flags "-mpreferred-stack-boundary=5"
+    lappend additional_flags "-mno-mmx"
 }
 
 dg-init