gcc/libgfortran/config/fpu-387.h

137 lines
4.1 KiB
C
Raw Normal View History

gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
/* FPU-related code for x86 and x86_64 processors.
config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. gcc: * config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. * doc/install.texi (Specific, i?86-*-solaris2.[89]): Recommend GNU as. Document SSE/SSE2 support. * doc/sourcebuild.texi (Effective-Target Keywords): Document sse. gcc/testsuite: * lib/target-supports.exp (check_effective_target_sse): New proc. * gcc.target/i386/sol2-check.h: New file. * gcc.target/i386/sse-check.h (ILL_INSN, ILL_INSN_LEN): Define. Include sol2-check.h. (main) Only run do_test () if sol2_check (). * gcc.target/i386/sse2-check.h: Likewise. * gcc.target/i386/sse3-check.h: Likewise. * gcc.dg/vect/tree-vect.h (check_vect) [__i386__ || __x86_64__] [__sun__ && __svr4__]: Execute SSE2 instruction. * gcc.target/i386/math-torture/math-torture.exp: Only add options with -msse to MATH_TORTURE_OPTIONS if check_effective_target_sse. * g++.dg/debug/dwarf2/const2b.C: Use dg-require-effective-target sse. * g++.dg/ext/vector14.C: Likewise. * g++.dg/other/mmintrin.C: Likewise. * gcc.dg/20020418-1.c: Likewise. * gcc.dg/debug/dwarf2/const-2b.c: Likewise. * gcc.dg/format/ms_unnamed-1.c: Likewise. * gcc.dg/format/unnamed-1.c: Likewise. Adapt dg-warning line number. * gcc.dg/graphite/pr40281.c: Likewise. * gcc.dg/pr32176.c: Likewise. * gcc.dg/pr40550.c: Likewise. * gcc.dg/prefetch-loop-arrays-1.c: Likewise. * gcc.dg/torture/pr36891.c: Likewise. * gcc.target/i386/20020218-1.c: Likewise. * gcc.target/i386/20020523.c: Likewise. * gcc.target/i386/abi-1.c: Likewise. * gcc.target/i386/brokensqrt.c: Likewise. * gcc.target/i386/fastcall-sseregparm.c: Likewise. * gcc.target/i386/pr13366.c: Likewise. * gcc.target/i386/pr13685.c: Likewise. * gcc.target/i386/pr24306.c: Likewise. * gcc.target/i386/pr31486.c: Likewise. * gcc.target/i386/pr32065-1.c: Likewise. * gcc.target/i386/pr32065-2.c: Likewise. * gcc.target/i386/pr32389.c: Likewise. * gcc.target/i386/pr38824.c: Likewise. * gcc.target/i386/pr38931.c: Likewise. * gcc.target/i386/pr39592-1.c: Likewise. * gcc.target/i386/pr43766.c: Likewise. * gcc.target/i386/recip-divf.c: Likewise. * gcc.target/i386/recip-sqrtf.c: Likewise. * gcc.target/i386/recip-vec-divf.c: Likewise. * gcc.target/i386/recip-vec-sqrtf.c: Likewise. * gcc.target/i386/sse-1.c: Likewise. * gcc.target/i386/sse-16.c: Likewise. * gcc.target/i386/sse-2.c: Likewise. * gcc.target/i386/sse-20.c: Likewise. * gcc.target/i386/sse-3.c: Likewise. * gcc.target/i386/sse-7.c: Likewise. * gcc.target/i386/sse-9.c: Likewise. * gcc.target/i386/sse-addps-1.c: Likewise. * gcc.target/i386/sse-addss-1.c: Likewise. * gcc.target/i386/sse-andnps-1.c: Likewise. * gcc.target/i386/sse-andps-1.c: Likewise. * gcc.target/i386/sse-cmpss-1.c: Likewise. * gcc.target/i386/sse-comiss-1.c: Likewise. * gcc.target/i386/sse-comiss-2.c: Likewise. * gcc.target/i386/sse-comiss-3.c: Likewise. * gcc.target/i386/sse-comiss-4.c: Likewise. * gcc.target/i386/sse-comiss-5.c: Likewise. * gcc.target/i386/sse-comiss-6.c: Likewise. * gcc.target/i386/sse-copysignf-vec.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-1.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-2.c: Likewise. * gcc.target/i386/sse-cvtss2si-1.c: Likewise. * gcc.target/i386/sse-cvtss2si-2.c: Likewise. * gcc.target/i386/sse-cvttss2si-1.c: Likewise. * gcc.target/i386/sse-cvttss2si-2.c: Likewise. * gcc.target/i386/sse-divps-1.c: Likewise. * gcc.target/i386/sse-divss-1.c: Likewise. * gcc.target/i386/sse-init-v4hi-1.c: Likewise. * gcc.target/i386/sse-init-v4sf-1.c: Likewise. * gcc.target/i386/sse-maxps-1.c: Likewise. * gcc.target/i386/sse-maxss-1.c: Likewise. * gcc.target/i386/sse-minps-1.c: Likewise. * gcc.target/i386/sse-minss-1.c: Likewise. * gcc.target/i386/sse-movaps-1.c: Likewise. * gcc.target/i386/sse-movaps-2.c: Likewise. * gcc.target/i386/sse-movhlps-1.c: Likewise. * gcc.target/i386/sse-movhps-1.c: Likewise. * gcc.target/i386/sse-movhps-2.c: Likewise. * gcc.target/i386/sse-movlhps-1.c: Likewise. * gcc.target/i386/sse-movmskps-1.c: Likewise. * gcc.target/i386/sse-movntps-1.c: Likewise. * gcc.target/i386/sse-movss-1.c: Likewise. * gcc.target/i386/sse-movss-2.c: Likewise. * gcc.target/i386/sse-movss-3.c: Likewise. * gcc.target/i386/sse-movups-1.c: Likewise. * gcc.target/i386/sse-movups-2.c: Likewise. * gcc.target/i386/sse-mulps-1.c: Likewise. * gcc.target/i386/sse-mulss-1.c: Likewise. * gcc.target/i386/sse-orps-1.c: Likewise. * gcc.target/i386/sse-rcpps-1.c: Likewise. * gcc.target/i386/sse-recip-vec.c: Likewise. * gcc.target/i386/sse-recip.c: Likewise. * gcc.target/i386/sse-rsqrtps-1.c: Likewise. * gcc.target/i386/sse-set-ps-1.c: Likewise. * gcc.target/i386/sse-sqrtps-1.c: Likewise. * gcc.target/i386/sse-subps-1.c: Likewise. * gcc.target/i386/sse-subss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-2.c: Likewise. * gcc.target/i386/sse-ucomiss-3.c: Likewise. * gcc.target/i386/sse-ucomiss-4.c: Likewise. * gcc.target/i386/sse-ucomiss-5.c: Likewise. * gcc.target/i386/sse-ucomiss-6.c: Likewise. * gcc.target/i386/sse-unpckhps-1.c: Likewise. * gcc.target/i386/sse-unpcklps-1.c: Likewise. * gcc.target/i386/sse-xorps-1.c: Likewise. * gcc.target/i386/ssefn-1.c: Likewise. * gcc.target/i386/ssefn-3.c: Likewise. * gcc.target/i386/sseregparm-1.c: Likewise. * gcc.target/i386/stackalign/return-3.c: Likewise. * gcc.target/i386/vectorize1.c: Likewise. * gcc.target/i386/vperm-v4sf-1.c: Likewise. * gcc.target/i386/xorps-sse.c: Likewise. * gfortran.dg/pr28158.f90: Likewise. * gfortran.dg/pr30667.f: Likewise. * gnat.dg/loop_optimization7.adb: Likewise. * gnat.dg/sse_nolib.adb: Likewise. libgfortran: * config/fpu-387.h [__sun__ && __svr4__] Include <signal.h>, <ucontext.h>. (sigill_caught): New. (sigill_hdlr): New function (has_sse) [__sun__ && __svr4__]: Check if SSE instruction causes SIGILL. From-SVN: r162073
2010-07-12 13:32:42 +02:00
Copyright 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
Contributed by Francois-Xavier Coudert <coudert@clipper.ens.fr>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran 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 of the License, or (at your option) any later version.
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
Libgfortran 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
#ifndef __x86_64__
#include "cpuid.h"
#endif
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. gcc: * config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. * doc/install.texi (Specific, i?86-*-solaris2.[89]): Recommend GNU as. Document SSE/SSE2 support. * doc/sourcebuild.texi (Effective-Target Keywords): Document sse. gcc/testsuite: * lib/target-supports.exp (check_effective_target_sse): New proc. * gcc.target/i386/sol2-check.h: New file. * gcc.target/i386/sse-check.h (ILL_INSN, ILL_INSN_LEN): Define. Include sol2-check.h. (main) Only run do_test () if sol2_check (). * gcc.target/i386/sse2-check.h: Likewise. * gcc.target/i386/sse3-check.h: Likewise. * gcc.dg/vect/tree-vect.h (check_vect) [__i386__ || __x86_64__] [__sun__ && __svr4__]: Execute SSE2 instruction. * gcc.target/i386/math-torture/math-torture.exp: Only add options with -msse to MATH_TORTURE_OPTIONS if check_effective_target_sse. * g++.dg/debug/dwarf2/const2b.C: Use dg-require-effective-target sse. * g++.dg/ext/vector14.C: Likewise. * g++.dg/other/mmintrin.C: Likewise. * gcc.dg/20020418-1.c: Likewise. * gcc.dg/debug/dwarf2/const-2b.c: Likewise. * gcc.dg/format/ms_unnamed-1.c: Likewise. * gcc.dg/format/unnamed-1.c: Likewise. Adapt dg-warning line number. * gcc.dg/graphite/pr40281.c: Likewise. * gcc.dg/pr32176.c: Likewise. * gcc.dg/pr40550.c: Likewise. * gcc.dg/prefetch-loop-arrays-1.c: Likewise. * gcc.dg/torture/pr36891.c: Likewise. * gcc.target/i386/20020218-1.c: Likewise. * gcc.target/i386/20020523.c: Likewise. * gcc.target/i386/abi-1.c: Likewise. * gcc.target/i386/brokensqrt.c: Likewise. * gcc.target/i386/fastcall-sseregparm.c: Likewise. * gcc.target/i386/pr13366.c: Likewise. * gcc.target/i386/pr13685.c: Likewise. * gcc.target/i386/pr24306.c: Likewise. * gcc.target/i386/pr31486.c: Likewise. * gcc.target/i386/pr32065-1.c: Likewise. * gcc.target/i386/pr32065-2.c: Likewise. * gcc.target/i386/pr32389.c: Likewise. * gcc.target/i386/pr38824.c: Likewise. * gcc.target/i386/pr38931.c: Likewise. * gcc.target/i386/pr39592-1.c: Likewise. * gcc.target/i386/pr43766.c: Likewise. * gcc.target/i386/recip-divf.c: Likewise. * gcc.target/i386/recip-sqrtf.c: Likewise. * gcc.target/i386/recip-vec-divf.c: Likewise. * gcc.target/i386/recip-vec-sqrtf.c: Likewise. * gcc.target/i386/sse-1.c: Likewise. * gcc.target/i386/sse-16.c: Likewise. * gcc.target/i386/sse-2.c: Likewise. * gcc.target/i386/sse-20.c: Likewise. * gcc.target/i386/sse-3.c: Likewise. * gcc.target/i386/sse-7.c: Likewise. * gcc.target/i386/sse-9.c: Likewise. * gcc.target/i386/sse-addps-1.c: Likewise. * gcc.target/i386/sse-addss-1.c: Likewise. * gcc.target/i386/sse-andnps-1.c: Likewise. * gcc.target/i386/sse-andps-1.c: Likewise. * gcc.target/i386/sse-cmpss-1.c: Likewise. * gcc.target/i386/sse-comiss-1.c: Likewise. * gcc.target/i386/sse-comiss-2.c: Likewise. * gcc.target/i386/sse-comiss-3.c: Likewise. * gcc.target/i386/sse-comiss-4.c: Likewise. * gcc.target/i386/sse-comiss-5.c: Likewise. * gcc.target/i386/sse-comiss-6.c: Likewise. * gcc.target/i386/sse-copysignf-vec.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-1.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-2.c: Likewise. * gcc.target/i386/sse-cvtss2si-1.c: Likewise. * gcc.target/i386/sse-cvtss2si-2.c: Likewise. * gcc.target/i386/sse-cvttss2si-1.c: Likewise. * gcc.target/i386/sse-cvttss2si-2.c: Likewise. * gcc.target/i386/sse-divps-1.c: Likewise. * gcc.target/i386/sse-divss-1.c: Likewise. * gcc.target/i386/sse-init-v4hi-1.c: Likewise. * gcc.target/i386/sse-init-v4sf-1.c: Likewise. * gcc.target/i386/sse-maxps-1.c: Likewise. * gcc.target/i386/sse-maxss-1.c: Likewise. * gcc.target/i386/sse-minps-1.c: Likewise. * gcc.target/i386/sse-minss-1.c: Likewise. * gcc.target/i386/sse-movaps-1.c: Likewise. * gcc.target/i386/sse-movaps-2.c: Likewise. * gcc.target/i386/sse-movhlps-1.c: Likewise. * gcc.target/i386/sse-movhps-1.c: Likewise. * gcc.target/i386/sse-movhps-2.c: Likewise. * gcc.target/i386/sse-movlhps-1.c: Likewise. * gcc.target/i386/sse-movmskps-1.c: Likewise. * gcc.target/i386/sse-movntps-1.c: Likewise. * gcc.target/i386/sse-movss-1.c: Likewise. * gcc.target/i386/sse-movss-2.c: Likewise. * gcc.target/i386/sse-movss-3.c: Likewise. * gcc.target/i386/sse-movups-1.c: Likewise. * gcc.target/i386/sse-movups-2.c: Likewise. * gcc.target/i386/sse-mulps-1.c: Likewise. * gcc.target/i386/sse-mulss-1.c: Likewise. * gcc.target/i386/sse-orps-1.c: Likewise. * gcc.target/i386/sse-rcpps-1.c: Likewise. * gcc.target/i386/sse-recip-vec.c: Likewise. * gcc.target/i386/sse-recip.c: Likewise. * gcc.target/i386/sse-rsqrtps-1.c: Likewise. * gcc.target/i386/sse-set-ps-1.c: Likewise. * gcc.target/i386/sse-sqrtps-1.c: Likewise. * gcc.target/i386/sse-subps-1.c: Likewise. * gcc.target/i386/sse-subss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-2.c: Likewise. * gcc.target/i386/sse-ucomiss-3.c: Likewise. * gcc.target/i386/sse-ucomiss-4.c: Likewise. * gcc.target/i386/sse-ucomiss-5.c: Likewise. * gcc.target/i386/sse-ucomiss-6.c: Likewise. * gcc.target/i386/sse-unpckhps-1.c: Likewise. * gcc.target/i386/sse-unpcklps-1.c: Likewise. * gcc.target/i386/sse-xorps-1.c: Likewise. * gcc.target/i386/ssefn-1.c: Likewise. * gcc.target/i386/ssefn-3.c: Likewise. * gcc.target/i386/sseregparm-1.c: Likewise. * gcc.target/i386/stackalign/return-3.c: Likewise. * gcc.target/i386/vectorize1.c: Likewise. * gcc.target/i386/vperm-v4sf-1.c: Likewise. * gcc.target/i386/xorps-sse.c: Likewise. * gfortran.dg/pr28158.f90: Likewise. * gfortran.dg/pr30667.f: Likewise. * gnat.dg/loop_optimization7.adb: Likewise. * gnat.dg/sse_nolib.adb: Likewise. libgfortran: * config/fpu-387.h [__sun__ && __svr4__] Include <signal.h>, <ucontext.h>. (sigill_caught): New. (sigill_hdlr): New function (has_sse) [__sun__ && __svr4__]: Check if SSE instruction causes SIGILL. From-SVN: r162073
2010-07-12 13:32:42 +02:00
#if defined(__sun__) && defined(__svr4__)
#include <signal.h>
#include <ucontext.h>
static volatile sig_atomic_t sigill_caught;
static void
sigill_hdlr (int sig __attribute((unused)),
siginfo_t *sip __attribute__((unused)),
ucontext_t *ucp)
{
sigill_caught = 1;
/* Set PC to the instruction after the faulting one to skip over it,
otherwise we enter an infinite loop. 4 is the size of the stmxcsr
instruction. */
ucp->uc_mcontext.gregs[EIP] += 4;
setcontext (ucp);
}
#endif
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
static int
has_sse (void)
{
#ifndef __x86_64__
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
unsigned int eax, ebx, ecx, edx;
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
return 0;
config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. gcc: * config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. * doc/install.texi (Specific, i?86-*-solaris2.[89]): Recommend GNU as. Document SSE/SSE2 support. * doc/sourcebuild.texi (Effective-Target Keywords): Document sse. gcc/testsuite: * lib/target-supports.exp (check_effective_target_sse): New proc. * gcc.target/i386/sol2-check.h: New file. * gcc.target/i386/sse-check.h (ILL_INSN, ILL_INSN_LEN): Define. Include sol2-check.h. (main) Only run do_test () if sol2_check (). * gcc.target/i386/sse2-check.h: Likewise. * gcc.target/i386/sse3-check.h: Likewise. * gcc.dg/vect/tree-vect.h (check_vect) [__i386__ || __x86_64__] [__sun__ && __svr4__]: Execute SSE2 instruction. * gcc.target/i386/math-torture/math-torture.exp: Only add options with -msse to MATH_TORTURE_OPTIONS if check_effective_target_sse. * g++.dg/debug/dwarf2/const2b.C: Use dg-require-effective-target sse. * g++.dg/ext/vector14.C: Likewise. * g++.dg/other/mmintrin.C: Likewise. * gcc.dg/20020418-1.c: Likewise. * gcc.dg/debug/dwarf2/const-2b.c: Likewise. * gcc.dg/format/ms_unnamed-1.c: Likewise. * gcc.dg/format/unnamed-1.c: Likewise. Adapt dg-warning line number. * gcc.dg/graphite/pr40281.c: Likewise. * gcc.dg/pr32176.c: Likewise. * gcc.dg/pr40550.c: Likewise. * gcc.dg/prefetch-loop-arrays-1.c: Likewise. * gcc.dg/torture/pr36891.c: Likewise. * gcc.target/i386/20020218-1.c: Likewise. * gcc.target/i386/20020523.c: Likewise. * gcc.target/i386/abi-1.c: Likewise. * gcc.target/i386/brokensqrt.c: Likewise. * gcc.target/i386/fastcall-sseregparm.c: Likewise. * gcc.target/i386/pr13366.c: Likewise. * gcc.target/i386/pr13685.c: Likewise. * gcc.target/i386/pr24306.c: Likewise. * gcc.target/i386/pr31486.c: Likewise. * gcc.target/i386/pr32065-1.c: Likewise. * gcc.target/i386/pr32065-2.c: Likewise. * gcc.target/i386/pr32389.c: Likewise. * gcc.target/i386/pr38824.c: Likewise. * gcc.target/i386/pr38931.c: Likewise. * gcc.target/i386/pr39592-1.c: Likewise. * gcc.target/i386/pr43766.c: Likewise. * gcc.target/i386/recip-divf.c: Likewise. * gcc.target/i386/recip-sqrtf.c: Likewise. * gcc.target/i386/recip-vec-divf.c: Likewise. * gcc.target/i386/recip-vec-sqrtf.c: Likewise. * gcc.target/i386/sse-1.c: Likewise. * gcc.target/i386/sse-16.c: Likewise. * gcc.target/i386/sse-2.c: Likewise. * gcc.target/i386/sse-20.c: Likewise. * gcc.target/i386/sse-3.c: Likewise. * gcc.target/i386/sse-7.c: Likewise. * gcc.target/i386/sse-9.c: Likewise. * gcc.target/i386/sse-addps-1.c: Likewise. * gcc.target/i386/sse-addss-1.c: Likewise. * gcc.target/i386/sse-andnps-1.c: Likewise. * gcc.target/i386/sse-andps-1.c: Likewise. * gcc.target/i386/sse-cmpss-1.c: Likewise. * gcc.target/i386/sse-comiss-1.c: Likewise. * gcc.target/i386/sse-comiss-2.c: Likewise. * gcc.target/i386/sse-comiss-3.c: Likewise. * gcc.target/i386/sse-comiss-4.c: Likewise. * gcc.target/i386/sse-comiss-5.c: Likewise. * gcc.target/i386/sse-comiss-6.c: Likewise. * gcc.target/i386/sse-copysignf-vec.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-1.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-2.c: Likewise. * gcc.target/i386/sse-cvtss2si-1.c: Likewise. * gcc.target/i386/sse-cvtss2si-2.c: Likewise. * gcc.target/i386/sse-cvttss2si-1.c: Likewise. * gcc.target/i386/sse-cvttss2si-2.c: Likewise. * gcc.target/i386/sse-divps-1.c: Likewise. * gcc.target/i386/sse-divss-1.c: Likewise. * gcc.target/i386/sse-init-v4hi-1.c: Likewise. * gcc.target/i386/sse-init-v4sf-1.c: Likewise. * gcc.target/i386/sse-maxps-1.c: Likewise. * gcc.target/i386/sse-maxss-1.c: Likewise. * gcc.target/i386/sse-minps-1.c: Likewise. * gcc.target/i386/sse-minss-1.c: Likewise. * gcc.target/i386/sse-movaps-1.c: Likewise. * gcc.target/i386/sse-movaps-2.c: Likewise. * gcc.target/i386/sse-movhlps-1.c: Likewise. * gcc.target/i386/sse-movhps-1.c: Likewise. * gcc.target/i386/sse-movhps-2.c: Likewise. * gcc.target/i386/sse-movlhps-1.c: Likewise. * gcc.target/i386/sse-movmskps-1.c: Likewise. * gcc.target/i386/sse-movntps-1.c: Likewise. * gcc.target/i386/sse-movss-1.c: Likewise. * gcc.target/i386/sse-movss-2.c: Likewise. * gcc.target/i386/sse-movss-3.c: Likewise. * gcc.target/i386/sse-movups-1.c: Likewise. * gcc.target/i386/sse-movups-2.c: Likewise. * gcc.target/i386/sse-mulps-1.c: Likewise. * gcc.target/i386/sse-mulss-1.c: Likewise. * gcc.target/i386/sse-orps-1.c: Likewise. * gcc.target/i386/sse-rcpps-1.c: Likewise. * gcc.target/i386/sse-recip-vec.c: Likewise. * gcc.target/i386/sse-recip.c: Likewise. * gcc.target/i386/sse-rsqrtps-1.c: Likewise. * gcc.target/i386/sse-set-ps-1.c: Likewise. * gcc.target/i386/sse-sqrtps-1.c: Likewise. * gcc.target/i386/sse-subps-1.c: Likewise. * gcc.target/i386/sse-subss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-2.c: Likewise. * gcc.target/i386/sse-ucomiss-3.c: Likewise. * gcc.target/i386/sse-ucomiss-4.c: Likewise. * gcc.target/i386/sse-ucomiss-5.c: Likewise. * gcc.target/i386/sse-ucomiss-6.c: Likewise. * gcc.target/i386/sse-unpckhps-1.c: Likewise. * gcc.target/i386/sse-unpcklps-1.c: Likewise. * gcc.target/i386/sse-xorps-1.c: Likewise. * gcc.target/i386/ssefn-1.c: Likewise. * gcc.target/i386/ssefn-3.c: Likewise. * gcc.target/i386/sseregparm-1.c: Likewise. * gcc.target/i386/stackalign/return-3.c: Likewise. * gcc.target/i386/vectorize1.c: Likewise. * gcc.target/i386/vperm-v4sf-1.c: Likewise. * gcc.target/i386/xorps-sse.c: Likewise. * gfortran.dg/pr28158.f90: Likewise. * gfortran.dg/pr30667.f: Likewise. * gnat.dg/loop_optimization7.adb: Likewise. * gnat.dg/sse_nolib.adb: Likewise. libgfortran: * config/fpu-387.h [__sun__ && __svr4__] Include <signal.h>, <ucontext.h>. (sigill_caught): New. (sigill_hdlr): New function (has_sse) [__sun__ && __svr4__]: Check if SSE instruction causes SIGILL. From-SVN: r162073
2010-07-12 13:32:42 +02:00
#if defined(__sun__) && defined(__svr4__)
/* Solaris 2 before Solaris 9 4/04 cannot execute SSE instructions even
if the CPU supports them. Programs receive SIGILL instead, so check
for that at runtime. */
if (edx & bit_SSE)
{
struct sigaction act, oact;
act.sa_handler = sigill_hdlr;
sigemptyset (&act.sa_mask);
/* Need to set SA_SIGINFO so a ucontext_t * is passed to the handler. */
act.sa_flags = SA_SIGINFO;
sigaction (SIGILL, &act, &oact);
/* We need a single SSE instruction here so the handler can safely skip
over it. */
__asm__ volatile ("movss %xmm2,%xmm1");
config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. gcc: * config.gcc (i[34567]86-*-solaris2*): Default with_arch_32 to pentiumpro on Solaris 8 and 9/x86. * doc/install.texi (Specific, i?86-*-solaris2.[89]): Recommend GNU as. Document SSE/SSE2 support. * doc/sourcebuild.texi (Effective-Target Keywords): Document sse. gcc/testsuite: * lib/target-supports.exp (check_effective_target_sse): New proc. * gcc.target/i386/sol2-check.h: New file. * gcc.target/i386/sse-check.h (ILL_INSN, ILL_INSN_LEN): Define. Include sol2-check.h. (main) Only run do_test () if sol2_check (). * gcc.target/i386/sse2-check.h: Likewise. * gcc.target/i386/sse3-check.h: Likewise. * gcc.dg/vect/tree-vect.h (check_vect) [__i386__ || __x86_64__] [__sun__ && __svr4__]: Execute SSE2 instruction. * gcc.target/i386/math-torture/math-torture.exp: Only add options with -msse to MATH_TORTURE_OPTIONS if check_effective_target_sse. * g++.dg/debug/dwarf2/const2b.C: Use dg-require-effective-target sse. * g++.dg/ext/vector14.C: Likewise. * g++.dg/other/mmintrin.C: Likewise. * gcc.dg/20020418-1.c: Likewise. * gcc.dg/debug/dwarf2/const-2b.c: Likewise. * gcc.dg/format/ms_unnamed-1.c: Likewise. * gcc.dg/format/unnamed-1.c: Likewise. Adapt dg-warning line number. * gcc.dg/graphite/pr40281.c: Likewise. * gcc.dg/pr32176.c: Likewise. * gcc.dg/pr40550.c: Likewise. * gcc.dg/prefetch-loop-arrays-1.c: Likewise. * gcc.dg/torture/pr36891.c: Likewise. * gcc.target/i386/20020218-1.c: Likewise. * gcc.target/i386/20020523.c: Likewise. * gcc.target/i386/abi-1.c: Likewise. * gcc.target/i386/brokensqrt.c: Likewise. * gcc.target/i386/fastcall-sseregparm.c: Likewise. * gcc.target/i386/pr13366.c: Likewise. * gcc.target/i386/pr13685.c: Likewise. * gcc.target/i386/pr24306.c: Likewise. * gcc.target/i386/pr31486.c: Likewise. * gcc.target/i386/pr32065-1.c: Likewise. * gcc.target/i386/pr32065-2.c: Likewise. * gcc.target/i386/pr32389.c: Likewise. * gcc.target/i386/pr38824.c: Likewise. * gcc.target/i386/pr38931.c: Likewise. * gcc.target/i386/pr39592-1.c: Likewise. * gcc.target/i386/pr43766.c: Likewise. * gcc.target/i386/recip-divf.c: Likewise. * gcc.target/i386/recip-sqrtf.c: Likewise. * gcc.target/i386/recip-vec-divf.c: Likewise. * gcc.target/i386/recip-vec-sqrtf.c: Likewise. * gcc.target/i386/sse-1.c: Likewise. * gcc.target/i386/sse-16.c: Likewise. * gcc.target/i386/sse-2.c: Likewise. * gcc.target/i386/sse-20.c: Likewise. * gcc.target/i386/sse-3.c: Likewise. * gcc.target/i386/sse-7.c: Likewise. * gcc.target/i386/sse-9.c: Likewise. * gcc.target/i386/sse-addps-1.c: Likewise. * gcc.target/i386/sse-addss-1.c: Likewise. * gcc.target/i386/sse-andnps-1.c: Likewise. * gcc.target/i386/sse-andps-1.c: Likewise. * gcc.target/i386/sse-cmpss-1.c: Likewise. * gcc.target/i386/sse-comiss-1.c: Likewise. * gcc.target/i386/sse-comiss-2.c: Likewise. * gcc.target/i386/sse-comiss-3.c: Likewise. * gcc.target/i386/sse-comiss-4.c: Likewise. * gcc.target/i386/sse-comiss-5.c: Likewise. * gcc.target/i386/sse-comiss-6.c: Likewise. * gcc.target/i386/sse-copysignf-vec.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-1.c: Likewise. * gcc.target/i386/sse-cvtsi2ss-2.c: Likewise. * gcc.target/i386/sse-cvtss2si-1.c: Likewise. * gcc.target/i386/sse-cvtss2si-2.c: Likewise. * gcc.target/i386/sse-cvttss2si-1.c: Likewise. * gcc.target/i386/sse-cvttss2si-2.c: Likewise. * gcc.target/i386/sse-divps-1.c: Likewise. * gcc.target/i386/sse-divss-1.c: Likewise. * gcc.target/i386/sse-init-v4hi-1.c: Likewise. * gcc.target/i386/sse-init-v4sf-1.c: Likewise. * gcc.target/i386/sse-maxps-1.c: Likewise. * gcc.target/i386/sse-maxss-1.c: Likewise. * gcc.target/i386/sse-minps-1.c: Likewise. * gcc.target/i386/sse-minss-1.c: Likewise. * gcc.target/i386/sse-movaps-1.c: Likewise. * gcc.target/i386/sse-movaps-2.c: Likewise. * gcc.target/i386/sse-movhlps-1.c: Likewise. * gcc.target/i386/sse-movhps-1.c: Likewise. * gcc.target/i386/sse-movhps-2.c: Likewise. * gcc.target/i386/sse-movlhps-1.c: Likewise. * gcc.target/i386/sse-movmskps-1.c: Likewise. * gcc.target/i386/sse-movntps-1.c: Likewise. * gcc.target/i386/sse-movss-1.c: Likewise. * gcc.target/i386/sse-movss-2.c: Likewise. * gcc.target/i386/sse-movss-3.c: Likewise. * gcc.target/i386/sse-movups-1.c: Likewise. * gcc.target/i386/sse-movups-2.c: Likewise. * gcc.target/i386/sse-mulps-1.c: Likewise. * gcc.target/i386/sse-mulss-1.c: Likewise. * gcc.target/i386/sse-orps-1.c: Likewise. * gcc.target/i386/sse-rcpps-1.c: Likewise. * gcc.target/i386/sse-recip-vec.c: Likewise. * gcc.target/i386/sse-recip.c: Likewise. * gcc.target/i386/sse-rsqrtps-1.c: Likewise. * gcc.target/i386/sse-set-ps-1.c: Likewise. * gcc.target/i386/sse-sqrtps-1.c: Likewise. * gcc.target/i386/sse-subps-1.c: Likewise. * gcc.target/i386/sse-subss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-1.c: Likewise. * gcc.target/i386/sse-ucomiss-2.c: Likewise. * gcc.target/i386/sse-ucomiss-3.c: Likewise. * gcc.target/i386/sse-ucomiss-4.c: Likewise. * gcc.target/i386/sse-ucomiss-5.c: Likewise. * gcc.target/i386/sse-ucomiss-6.c: Likewise. * gcc.target/i386/sse-unpckhps-1.c: Likewise. * gcc.target/i386/sse-unpcklps-1.c: Likewise. * gcc.target/i386/sse-xorps-1.c: Likewise. * gcc.target/i386/ssefn-1.c: Likewise. * gcc.target/i386/ssefn-3.c: Likewise. * gcc.target/i386/sseregparm-1.c: Likewise. * gcc.target/i386/stackalign/return-3.c: Likewise. * gcc.target/i386/vectorize1.c: Likewise. * gcc.target/i386/vperm-v4sf-1.c: Likewise. * gcc.target/i386/xorps-sse.c: Likewise. * gfortran.dg/pr28158.f90: Likewise. * gfortran.dg/pr30667.f: Likewise. * gnat.dg/loop_optimization7.adb: Likewise. * gnat.dg/sse_nolib.adb: Likewise. libgfortran: * config/fpu-387.h [__sun__ && __svr4__] Include <signal.h>, <ucontext.h>. (sigill_caught): New. (sigill_hdlr): New function (has_sse) [__sun__ && __svr4__]: Check if SSE instruction causes SIGILL. From-SVN: r162073
2010-07-12 13:32:42 +02:00
sigaction (SIGILL, &oact, NULL);
if (sigill_caught)
return 0;
}
#endif /* __sun__ && __svr4__ */
return edx & bit_SSE;
#else
return 1;
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
#endif
}
/* i387 -- see linux <fpu_control.h> header file for details. */
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
#define _FPU_MASK_IM 0x01
#define _FPU_MASK_DM 0x02
#define _FPU_MASK_ZM 0x04
#define _FPU_MASK_OM 0x08
#define _FPU_MASK_UM 0x10
#define _FPU_MASK_PM 0x20
void set_fpu (void)
{
unsigned short cw;
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
asm volatile ("fnstcw %0" : "=m" (cw));
cw |= (_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM
| _FPU_MASK_UM | _FPU_MASK_PM);
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
if (options.fpe & GFC_FPE_INVALID) cw &= ~_FPU_MASK_IM;
if (options.fpe & GFC_FPE_DENORMAL) cw &= ~_FPU_MASK_DM;
if (options.fpe & GFC_FPE_ZERO) cw &= ~_FPU_MASK_ZM;
if (options.fpe & GFC_FPE_OVERFLOW) cw &= ~_FPU_MASK_OM;
if (options.fpe & GFC_FPE_UNDERFLOW) cw &= ~_FPU_MASK_UM;
if (options.fpe & GFC_FPE_PRECISION) cw &= ~_FPU_MASK_PM;
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
asm volatile ("fldcw %0" : : "m" (cw));
if (has_sse())
{
unsigned int cw_sse;
asm volatile ("stmxcsr %0" : "=m" (cw_sse));
cw_sse &= 0xffff0000;
cw_sse |= (_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM
| _FPU_MASK_UM | _FPU_MASK_PM ) << 7;
if (options.fpe & GFC_FPE_INVALID) cw_sse &= ~(_FPU_MASK_IM << 7);
if (options.fpe & GFC_FPE_DENORMAL) cw_sse &= ~(_FPU_MASK_DM << 7);
if (options.fpe & GFC_FPE_ZERO) cw_sse &= ~(_FPU_MASK_ZM << 7);
if (options.fpe & GFC_FPE_OVERFLOW) cw_sse &= ~(_FPU_MASK_OM << 7);
if (options.fpe & GFC_FPE_UNDERFLOW) cw_sse &= ~(_FPU_MASK_UM << 7);
if (options.fpe & GFC_FPE_PRECISION) cw_sse &= ~(_FPU_MASK_PM << 7);
asm volatile ("ldmxcsr %0" : : "m" (cw_sse));
gfortran.h: Add bitmasks for different FPE traps. * gfortran.h: Add bitmasks for different FPE traps. Add fpe member to options_t. * invoke.texi: Document the new -ffpe-trap option. * lang.opt: Add -ffpe-trap option. * options.c (gfc_init_options): Initialize the FPE option. (gfc_handle_fpe_trap_option): New function to parse the argument of the -ffpe-trap option. (gfc_handle_option): Add case for -ffpe-trap. * trans-decl.c: Declare a tree for the set_fpe library function. (gfc_build_builtin_function_decls): Build this tree. (gfc_generate_function_code): Generate a call to set_fpe at the beginning of the main program. * trans.h: New tree for the set_fpe library function. * Makefile.am: Add fpu.c to the build process, and target-dependent code as fpu-target.h. * Makefile.in: Regenerate. * configure.ac: Add call to configure.host to set FPU_HOST_HEADER. * configure: Regenerate. * config.h.in: Regenerate. * aclocal.m4: Regenerate. * configure.host: New script to determine which host-dependent code should go in. * libgfortran.h: Add fpe option, remove previous fpu_ options. Add bitmasks for different FPE traps. Add prototype for set_fpu. * runtime/environ.c: Remove environment variables to control fpu behaviour. * runtime/fpu.c (set_fpe): New function for the front-end. * runtime/main.c (init): Set FPU state. * config: New directory to store host-dependent code. * config/fpu-387.h: New file with code handling the i387 FPU. * config/fpu-glibc.h: New file with code for glibc systems. * config/fpu-generic.h: Fallback for the most generic host. Issue warnings. From-SVN: r105328
2005-10-12 22:21:31 +02:00
}
}