diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7113dce7e1b..51b48591a71 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-02-06 Jakub Jelinek + + * omp-expand.c (oxpand_omp_atomic_fetch_op, + expand_omp_atomic_pipeline): Return false if can_atomic_load_p is + false. + 2017-02-06 Segher Boessenkool PR rtl-optimization/68664 diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 327c2e73d91..736573611a3 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -6241,7 +6241,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb, matter is that (with the exception of i486 vs i586 and xadd) all targets that support any atomic operaton optab also implements compare-and-swap. Let optabs.c take care of expanding any compare-and-swap loop. */ - if (!can_compare_and_swap_p (imode, true)) + if (!can_compare_and_swap_p (imode, true) || !can_atomic_load_p (imode)) return false; gsi = gsi_last_bb (load_bb); @@ -6318,7 +6318,8 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb, type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr))); itype = TREE_TYPE (TREE_TYPE (cmpxchg)); - if (!can_compare_and_swap_p (TYPE_MODE (itype), true)) + if (!can_compare_and_swap_p (TYPE_MODE (itype), true) + || !can_atomic_load_p (TYPE_MODE (itype))) return false; /* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */