Commit 286934b4 by Uros Bizjak

alpha.c (alpha_atomic_assign_expand_fenv): New.

	* config/alpha/alpha.c (alpha_atomic_assign_expand_fenv): New.
	(TARGET_ATOMIC_ASSIGN_EXPAND_FENV): New define.

testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_fenv_exceptions):
	Add IEEE options to compile flags.
	* gcc.dg/atomic/c11-atomic-exec-5.c: Ditto.  Add -mieee-with-inexact
	additional option and lower ITER_COUNT to 100 for alpha*-*-* targets.

From-SVN: r212568
parent 6259a78a
2014-07-14 Jan Hubicka <hubicka@ucw.cz> 2014-07-15 Uros Bizjak <ubizjak@gmail.com>
* config/alpha/alpha.c (alpha_atomic_assign_expand_fenv): New.
(TARGET_ATOMIC_ASSIGN_EXPAND_FENV): New define.
2014-07-15 Jan Hubicka <hubicka@ucw.cz>
* fold-const.c (fold_checksum_tree): Fix typo in previous patch. * fold-const.c (fold_checksum_tree): Fix typo in previous patch.
...@@ -12,8 +17,7 @@ ...@@ -12,8 +17,7 @@
2014-07-15 Michael Matz <matz@suse.de> 2014-07-15 Michael Matz <matz@suse.de>
PR rtl-optimization/61772 PR rtl-optimization/61772
* ifcvt.c (dead_or_predicable): Check jump to be free of side * ifcvt.c (dead_or_predicable): Check jump to be free of side effects.
effects.
2014-07-15 Richard Biener <rguenther@suse.de> 2014-07-15 Richard Biener <rguenther@suse.de>
...@@ -21,8 +25,7 @@ ...@@ -21,8 +25,7 @@
2014-07-14 Jan Hubicka <hubicka@ucw.cz> 2014-07-14 Jan Hubicka <hubicka@ucw.cz>
* fold-const.c (fold_checksum_tree): Move checking of * fold-const.c (fold_checksum_tree): Move checking of DECL_RESULT.
DECL_RESULT.
2014-07-14 Jan Hubicka <hubicka@ucw.cz> 2014-07-14 Jan Hubicka <hubicka@ucw.cz>
...@@ -117,8 +120,7 @@ ...@@ -117,8 +120,7 @@
(TV_IPA_LTO_CTORS_IN, TV_IPA_LTO_CTORS_OUT): New timevar. (TV_IPA_LTO_CTORS_IN, TV_IPA_LTO_CTORS_OUT): New timevar.
* cgraph.c (cgraph_get_body): Push GIMPLE_IN timevar. * cgraph.c (cgraph_get_body): Push GIMPLE_IN timevar.
(varpool_get_constructor): Push CTORS_IN timevar. (varpool_get_constructor): Push CTORS_IN timevar.
* lto-streamer-out.c (lto_output): Push TV_IPA_LTO_CTORS_OUT * lto-streamer-out.c (lto_output): Push TV_IPA_LTO_CTORS_OUT timevar.
timevar.
2014-07-12 Uros Bizjak <ubizjak@gmail.com> 2014-07-12 Uros Bizjak <ubizjak@gmail.com>
......
...@@ -9888,6 +9888,72 @@ alpha_canonicalize_comparison (int *code, rtx *op0, rtx *op1, ...@@ -9888,6 +9888,72 @@ alpha_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
*op1 = GEN_INT (255); *op1 = GEN_INT (255);
} }
} }
/* Implement TARGET_ATOMIC_ASSIGN_EXPAND_FENV. */
static void
alpha_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
{
const unsigned HOST_WIDE_INT SWCR_STATUS_MASK = (0x3fUL << 17);
tree fenv_var, get_fpscr, set_fpscr, mask, ld_fenv, masked_fenv;
tree new_fenv_var, reload_fenv, restore_fnenv;
tree update_call, atomic_feraiseexcept, hold_fnclex;
/* Assume OSF/1 compatible interfaces. */
if (!TARGET_ABI_OSF)
return;
/* Generate the equivalent of :
unsigned long fenv_var;
fenv_var = __ieee_get_fp_control ();
unsigned long masked_fenv;
masked_fenv = fenv_var & mask;
__ieee_set_fp_control (masked_fenv); */
fenv_var = create_tmp_var (long_unsigned_type_node, NULL);
get_fpscr
= build_fn_decl ("__ieee_get_fp_control",
build_function_type_list (long_unsigned_type_node, NULL));
set_fpscr
= build_fn_decl ("__ieee_set_fp_control",
build_function_type_list (void_type_node, NULL));
mask = build_int_cst (long_unsigned_type_node, ~SWCR_STATUS_MASK);
ld_fenv = build2 (MODIFY_EXPR, long_unsigned_type_node,
fenv_var, build_call_expr (get_fpscr, 0));
masked_fenv = build2 (BIT_AND_EXPR, long_unsigned_type_node, fenv_var, mask);
hold_fnclex = build_call_expr (set_fpscr, 1, masked_fenv);
*hold = build2 (COMPOUND_EXPR, void_type_node,
build2 (COMPOUND_EXPR, void_type_node, masked_fenv, ld_fenv),
hold_fnclex);
/* Store the value of masked_fenv to clear the exceptions:
__ieee_set_fp_control (masked_fenv); */
*clear = build_call_expr (set_fpscr, 1, masked_fenv);
/* Generate the equivalent of :
unsigned long new_fenv_var;
new_fenv_var = __ieee_get_fp_control ();
__ieee_set_fp_control (fenv_var);
__atomic_feraiseexcept (new_fenv_var); */
new_fenv_var = create_tmp_var (long_unsigned_type_node, NULL);
reload_fenv = build2 (MODIFY_EXPR, long_unsigned_type_node, new_fenv_var,
build_call_expr (get_fpscr, 0));
restore_fnenv = build_call_expr (set_fpscr, 1, fenv_var);
atomic_feraiseexcept = builtin_decl_implicit (BUILT_IN_ATOMIC_FERAISEEXCEPT);
update_call
= build_call_expr (atomic_feraiseexcept, 1,
fold_convert (integer_type_node, new_fenv_var));
*update = build2 (COMPOUND_EXPR, void_type_node,
build2 (COMPOUND_EXPR, void_type_node,
reload_fenv, restore_fnenv), update_call);
}
/* Initialize the GCC target structure. */ /* Initialize the GCC target structure. */
#if TARGET_ABI_OPEN_VMS #if TARGET_ABI_OPEN_VMS
...@@ -10060,6 +10126,9 @@ alpha_canonicalize_comparison (int *code, rtx *op0, rtx *op1, ...@@ -10060,6 +10126,9 @@ alpha_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
#undef TARGET_CANONICALIZE_COMPARISON #undef TARGET_CANONICALIZE_COMPARISON
#define TARGET_CANONICALIZE_COMPARISON alpha_canonicalize_comparison #define TARGET_CANONICALIZE_COMPARISON alpha_canonicalize_comparison
#undef TARGET_ATOMIC_ASSIGN_EXPAND_FENV
#define TARGET_ATOMIC_ASSIGN_EXPAND_FENV alpha_atomic_assign_expand_fenv
struct gcc_target targetm = TARGET_INITIALIZER; struct gcc_target targetm = TARGET_INITIALIZER;
......
2014-07-15 Uros Bizjak <ubizjak@gmail.com>
* lib/target-supports.exp (check_effective_target_fenv_exceptions):
Add IEEE options to compile flags.
* gcc.dg/atomic/c11-atomic-exec-5.c: Ditto. Add -mieee-with-inexact
additional option and lower ITER_COUNT to 100 for alpha*-*-* targets.
2014-07-15 Michael Matz <matz@suse.de> 2014-07-15 Michael Matz <matz@suse.de>
PR rtl-optimization/61772 PR rtl-optimization/61772
...@@ -67,8 +74,7 @@ ...@@ -67,8 +74,7 @@
2014-07-13 Tobias Burnus <burnus@net-b.de> 2014-07-13 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_atomic_4.f90: Avoid using a kind=16 * gfortran.dg/coarray_atomic_4.f90: Avoid using a kind=16 integer.
integer.
2014-07-12 Paul Thomas <pault@gcc.gnu.org> 2014-07-12 Paul Thomas <pault@gcc.gnu.org>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
out in two threads. */ out in two threads. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */ /* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */
/* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } } /* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } } */
/* { dg-require-effective-target pthread } */ /* { dg-require-effective-target pthread } */
#include <stdint.h> #include <stdint.h>
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
get properly cleared). */ get properly cleared). */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */ /* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */
/* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } } /* { dg-add-options ieee } */
/* { dg-additional-options "-mieee-with-inexact" { target alpha*-*-* } } */
/* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } } */
/* { dg-require-effective-target fenv_exceptions } */ /* { dg-require-effective-target fenv_exceptions } */
/* { dg-require-effective-target pthread } */ /* { dg-require-effective-target pthread } */
...@@ -21,7 +23,11 @@ ...@@ -21,7 +23,11 @@
| FE_OVERFLOW \ | FE_OVERFLOW \
| FE_UNDERFLOW) | FE_UNDERFLOW)
#define ITER_COUNT 10000 #if defined __alpha__
#define ITER_COUNT 100
#else
#define ITER_COUNT 10000
#endif
static volatile _Atomic bool thread_ready, thread_stop; static volatile _Atomic bool thread_ready, thread_stop;
......
...@@ -5923,7 +5923,7 @@ proc check_effective_target_fenv_exceptions {} { ...@@ -5923,7 +5923,7 @@ proc check_effective_target_fenv_exceptions {} {
else else
abort (); abort ();
} }
} "-std=gnu99"] } [add_options_for_ieee "-std=gnu99"]]
} }
# Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target. # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment