This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ia64 flush to zero mode
On Sat, Jun 23, 2001 at 12:26:13PM +0200, Toon Moene wrote:
> > The following enables flush-to-zero mode (vs creating denormalized numbers)
> > when linking with -ffast-math or -funsafe-math-optimizations on ia64.
>
> Would it be possible to do the same on Alpha ?
Done.
Tested only on linux so far; I'll do tru64 in a moment.
r~
* config/alpha/crtfastmath.c: New file.
* config/alpha/t-crtfm: New file.
* config/alpha/elf.h (ENDFILE_SPEC): Use crtfastmath.o.
* config/alpha/osf.h (ENDFILE_SPEC): Likewise.
* config/alpha/t-crtbe (EXTRA_PARTS): Add pieces defined here.
* config.gcc (alpha-{linux,freebsd,netbsd,osf}): Use alpha/t-crtfm;
do not set extra_parts here.
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.67
diff -c -p -d -r1.67 config.gcc
*** config.gcc 2001/06/09 20:37:29 1.67
--- config.gcc 2001/06/24 02:00:03
*************** alpha*-*-linux*ecoff*)
*** 430,437 ****
alpha*-*-linux*libc1*)
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
target_cpu_default="MASK_GAS"
! tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1 alpha/t-alpha alpha/t-crtbe alpha/t-ieee"
! extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
--- 430,436 ----
alpha*-*-linux*libc1*)
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
target_cpu_default="MASK_GAS"
! tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1 alpha/t-alpha alpha/t-crtbe alpha/t-crtfm alpha/t-ieee"
gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
*************** alpha*-*-linux*libc1*)
*** 440,447 ****
alpha*-*-linux*)
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
target_cpu_default="MASK_GAS"
! tmake_file="t-slibgcc-elf-ver t-linux alpha/t-crtbe alpha/t-alpha alpha/t-ieee"
! extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
--- 439,445 ----
alpha*-*-linux*)
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
target_cpu_default="MASK_GAS"
! tmake_file="t-slibgcc-elf-ver t-linux alpha/t-crtbe alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then
thread_file='posix'
*************** alpha*-*-linux*)
*** 450,463 ****
alpha*-*-freebsd*)
tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
target_cpu_default="MASK_GAS"
! tmake_file="${tmake_file} alpha/t-crtbe alpha/t-alpha alpha/t-ieee"
;;
alpha*-*-netbsd*)
xm_defines=POSIX
tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h"
target_cpu_default="MASK_GAS"
! tmake_file="alpha/t-crtbe alpha/t-alpha alpha/t-ieee"
! extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
gas=yes gnu_ld=yes
;;
--- 448,460 ----
alpha*-*-freebsd*)
tm_file="${tm_file} ${fbsd_tm_file} alpha/elf.h alpha/freebsd.h"
target_cpu_default="MASK_GAS"
! tmake_file="${tmake_file} alpha/t-crtbe alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
;;
alpha*-*-netbsd*)
xm_defines=POSIX
tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h"
target_cpu_default="MASK_GAS"
! tmake_file="alpha/t-crtbe alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
gas=yes gnu_ld=yes
;;
*************** alpha*-dec-osf*)
*** 478,484 ****
extra_passes="mips-tfile mips-tdump"
fi
use_collect2=yes
! tmake_file="alpha/t-alpha alpha/t-ieee alpha/t-osf"
case $machine in
*-*-osf1*)
tm_file="${tm_file} alpha/osf.h alpha/osf12.h alpha/osf2or3.h"
--- 475,481 ----
extra_passes="mips-tfile mips-tdump"
fi
use_collect2=yes
! tmake_file="alpha/t-alpha alpha/t-ieee alpha/t-osf alpha/t-crtfm"
case $machine in
*-*-osf1*)
tm_file="${tm_file} alpha/osf.h alpha/osf12.h alpha/osf2or3.h"
Index: config/alpha/crtfastmath.c
===================================================================
RCS file: crtfastmath.c
diff -N crtfastmath.c
*** /dev/null Tue May 5 13:32:27 1998
--- crtfastmath.c Sat Jun 23 19:00:03 2001
***************
*** 0 ****
--- 1,46 ----
+ /*
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ * Contributed by Richard Henderson (rth@redhat.com)
+ *
+ * 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, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, 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.
+ */
+
+ /* Assume OSF/1 compatible interfaces. */
+
+ extern void __ieee_set_fp_control (unsigned long int);
+
+ #define IEEE_MAP_DMZ (1UL<<12) /* Map denorm inputs to zero */
+ #define IEEE_MAP_UMZ (1UL<<13) /* Map underflowed outputs to zero */
+
+ static void __attribute__((constructor))
+ set_fast_math (void)
+ {
+ __ieee_set_fp_control (IEEE_MAP_DMZ | IEEE_MAP_UMZ);
+ }
Index: config/alpha/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/elf.h,v
retrieving revision 1.39
diff -c -p -d -r1.39 elf.h
*** elf.h 2001/06/08 00:47:58 1.39
--- elf.h 2001/06/24 02:00:03
*************** void FN () \
*** 677,683 ****
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
! "%{shared:crtendS.o%s}%{!shared:crtend.o%s} crtn.o%s"
/* We support #pragma. */
#define HANDLE_SYSV_PRAGMA
--- 677,684 ----
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
! "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
! %{shared:crtendS.o%s}%{!shared:crtend.o%s} crtn.o%s"
/* We support #pragma. */
#define HANDLE_SYSV_PRAGMA
Index: config/alpha/osf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/osf.h,v
retrieving revision 1.18
diff -c -p -d -r1.18 osf.h
*** osf.h 2001/06/11 16:21:52 1.18
--- osf.h 2001/06/24 02:00:03
*************** Boston, MA 02111-1307, USA. */
*** 68,73 ****
--- 68,76 ----
#define STARTFILE_SPEC \
"%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}"
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+
#define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
#define ASM_FILE_START(FILE) \
Index: config/alpha/t-crtbe
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/t-crtbe,v
retrieving revision 1.4
diff -c -p -d -r1.4 t-crtbe
*** t-crtbe 2000/04/30 10:56:21 1.4
--- t-crtbe 2001/06/24 02:00:03
***************
*** 1,6 ****
--- 1,8 ----
# Effectively disable the crtbegin/end rules using crtstuff.c
T = disable
+ EXTRA_PARTS += crtbegin.o crtend.o crtbeginS.o crtendS.o
+
# Assemble startup files.
crtbegin.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtbegin.asm
Index: config/alpha/t-crtfm
===================================================================
RCS file: t-crtfm
diff -N t-crtfm
*** /dev/null Tue May 5 13:32:27 1998
--- t-crtfm Sat Jun 23 19:00:03 2001
***************
*** 0 ****
--- 1,4 ----
+ EXTRA_PARTS += crtfastmath.o
+
+ crtfastmath.o: $(srcdir)/config/alpha/crtfastmath.c $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crtfastmath.o $(srcdir)/config/alpha/crtfastmath.c