diff options
author | Richard Henderson <rth@redhat.com> | 2011-11-07 15:11:55 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2011-11-07 15:11:55 -0800 |
commit | cedb4a1ad0ff0cfbcbd29a1066b440bc66887f4d (patch) | |
tree | 52678eae26470ab300ea093fc393e910585625cb /gcc/omp-low.c | |
parent | 13fc31c2c49bbe4ca18bb1bf90007d03ba7ab13b (diff) | |
download | gcc-cedb4a1ad0ff0cfbcbd29a1066b440bc66887f4d.zip gcc-cedb4a1ad0ff0cfbcbd29a1066b440bc66887f4d.tar.gz gcc-cedb4a1ad0ff0cfbcbd29a1066b440bc66887f4d.tar.bz2 |
Allow libcalls to be installed for legacy __sync optabs.
This allows a target which implements the __sync interfaces
in libgcc to continue to use them transparently with the
new __atomic builtins.
It is assumed that these libgcc routines DO NOT use spinlocks.
This is true of all extant libgcc instances.
* optabs.h (OTI_sync_compare_and_swap, OTI_sync_lock_test_and_set,
OTI_sync_old_add, OTI_sync_old_sub, OTI_sync_old_ior,
OTI_sync_old_and, OTI_sync_old_xor, OTI_sync_old_nand,
OTI_sync_new_add, OTI_sync_new_sub, OTI_sync_new_ior,
OTI_sync_new_and, OTI_sync_new_xor, OTI_sync_new_nand): Move and
rename from the direct_optab_index enum.
(sync_compare_and_swap_optab, sync_lock_test_and_set_optab,
sync_old_add_optab, sync_old_sub_optab, sync_old_ior_optab,
sync_old_and_optab, sync_old_xor_optab, sync_old_nand_optab,
sync_new_add_optab, sync_new_sub_optab, sync_new_ior_optab,
sync_new_and_optab, sync_new_xor_optab, sync_new_nand_optab): Read
from the optab_table, not the direct_optab_table.
(init_sync_libfuncs): Declare.
(can_compare_and_swap_p): Update parameters.
* optabs.c (init_sync_libfuncs_1, init_sync_libfuncs): New.
(can_compare_and_swap_p): Add allow_libcall parameter; if true,
test for the legacy compare-and-swap libcall.
(expand_atomic_exchange): Use the legacy test-and-set libcall.
(expand_atomic_compare_and_swap): Use the legacy CAS libcall.
(struct atomic_op_functions): Update for optab type changes.
(maybe_emit_op): Likewise.
(expand_atomic_fetch_op): Use the legacy fetch-op libcalls.
* builtins.c (fold_builtin_atomic_always_lock_free): Update call
to can_compare_and_swap_p.
* omp-low.c (expand_omp_atomic_fetch_op): Likewise.
(expand_omp_atomic_pipeline): Likewise.
* genopinit.c (optabs): Make sync_old_*_optab, sync_new_*_optab,
sync_compare_and_swap_optab, sync_lock_test_and_set_optab regular
optabs.
From-SVN: r181134
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index d8e7ce3..8145957 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -5097,7 +5097,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)) + if (!can_compare_and_swap_p (imode, true)) return false; gsi = gsi_last_bb (load_bb); @@ -5168,7 +5168,7 @@ 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))) + if (!can_compare_and_swap_p (TYPE_MODE (itype), true)) return false; /* Load the initial value, replacing the GIMPLE_OMP_ATOMIC_LOAD. */ |