gcc/libgfortran/config/fpu-387.h

262 lines
6.4 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.
Copyright (C) 2005-2014 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 __SSE_MATH__
#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. 3 is the size of the movaps
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
instruction. */
ucp->uc_mcontext.gregs[EIP] += 3;
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
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 __SSE_MATH__
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__ ("movaps\t%xmm0,%xmm0");
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 exceptions -- 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
#define _FPU_MASK_ALL 0x3f
#define _FPU_EX_ALL 0x3f
/* i387 rounding modes. */
#define _FPU_RC_NEAREST 0x0
#define _FPU_RC_DOWN 0x1
#define _FPU_RC_UP 0x2
#define _FPU_RC_ZERO 0x3
#define _FPU_RC_MASK 0x3
void
set_fpu (void)
{
int excepts = 0;
unsigned short cw;
__asm__ __volatile__ ("fstcw\t%0" : "=m" (cw));
if (options.fpe & GFC_FPE_INVALID) excepts |= _FPU_MASK_IM;
if (options.fpe & GFC_FPE_DENORMAL) excepts |= _FPU_MASK_DM;
if (options.fpe & GFC_FPE_ZERO) excepts |= _FPU_MASK_ZM;
if (options.fpe & GFC_FPE_OVERFLOW) excepts |= _FPU_MASK_OM;
if (options.fpe & GFC_FPE_UNDERFLOW) excepts |= _FPU_MASK_UM;
if (options.fpe & GFC_FPE_INEXACT) excepts |= _FPU_MASK_PM;
cw |= _FPU_MASK_ALL;
cw &= ~excepts;
__asm__ __volatile__ ("fnclex\n\tfldcw\t%0" : : "m" (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
if (has_sse())
{
unsigned int cw_sse;
__asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse));
/* The SSE exception masks are shifted by 7 bits. */
cw_sse |= _FPU_MASK_ALL << 7;
cw_sse &= ~(excepts << 7);
/* Clear stalled exception flags. */
cw_sse &= ~_FPU_EX_ALL;
__asm__ __volatile__ ("%vldmxcsr\t%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
}
}
int
get_fpu_except_flags (void)
{
unsigned short cw;
int excepts;
int result = 0;
__asm__ __volatile__ ("fnstsw\t%0" : "=a" (cw));
excepts = cw;
if (has_sse())
{
unsigned int cw_sse;
__asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse));
excepts |= cw_sse;
}
excepts &= _FPU_EX_ALL;
if (excepts & _FPU_MASK_IM) result |= GFC_FPE_INVALID;
if (excepts & _FPU_MASK_DM) result |= GFC_FPE_DENORMAL;
if (excepts & _FPU_MASK_ZM) result |= GFC_FPE_ZERO;
if (excepts & _FPU_MASK_OM) result |= GFC_FPE_OVERFLOW;
if (excepts & _FPU_MASK_UM) result |= GFC_FPE_UNDERFLOW;
if (excepts & _FPU_MASK_PM) result |= GFC_FPE_INEXACT;
return result;
}
void
set_fpu_rounding_mode (int round)
{
int round_mode;
unsigned short cw;
switch (round)
{
case GFC_FPE_TONEAREST:
round_mode = _FPU_RC_NEAREST;
break;
case GFC_FPE_UPWARD:
round_mode = _FPU_RC_UP;
break;
case GFC_FPE_DOWNWARD:
round_mode = _FPU_RC_DOWN;
break;
case GFC_FPE_TOWARDZERO:
round_mode = _FPU_RC_ZERO;
break;
default:
return; /* Should be unreachable. */
}
__asm__ __volatile__ ("fnstcw\t%0" : "=m" (cw));
/* The x87 round control bits are shifted by 10 bits. */
cw &= ~(_FPU_RC_MASK << 10);
cw |= round_mode << 10;
__asm__ __volatile__ ("fldcw\t%0" : : "m" (cw));
if (has_sse())
{
unsigned int cw_sse;
__asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse));
/* The SSE round control bits are shifted by 13 bits. */
cw_sse &= ~(_FPU_RC_MASK << 13);
cw_sse |= round_mode << 13;
__asm__ __volatile__ ("%vldmxcsr\t%0" : : "m" (cw_sse));
}
}
int
get_fpu_rounding_mode (void)
{
int round_mode;
#ifdef __SSE_MATH__
unsigned int cw;
__asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw));
/* The SSE round control bits are shifted by 13 bits. */
round_mode = cw >> 13;
#else
unsigned short cw;
__asm__ __volatile__ ("fnstcw\t%0" : "=m" (cw));
/* The x87 round control bits are shifted by 10 bits. */
round_mode = cw >> 10;
#endif
round_mode &= _FPU_RC_MASK;
switch (round_mode)
{
case _FPU_RC_NEAREST:
return GFC_FPE_TONEAREST;
case _FPU_RC_UP:
return GFC_FPE_UPWARD;
case _FPU_RC_DOWN:
return GFC_FPE_DOWNWARD;
case _FPU_RC_ZERO:
return GFC_FPE_TOWARDZERO;
default:
return GFC_FPE_INVALID; /* Should be unreachable. */
}
}