summaryrefslogtreecommitdiff
path: root/gcc/config/cris/cris.c
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-16 03:18:23 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-16 03:18:23 +0000
commit102c21ad4eb73a635450dceaa095df1f815ced18 (patch)
tree3da01c0897396ffedb1b61b55133dc2a9f7c3389 /gcc/config/cris/cris.c
parent71b2d56aa61074317b51946510fc1300a84eb9d3 (diff)
downloadgcc-102c21ad4eb73a635450dceaa095df1f815ced18.tar.gz
* config/cris/cris.c (cris_init_libfuncs): Handle initialization
of library functions for basic atomic compare-and-swap. * config/cris/cris.h (TARGET_ATOMICS_MAY_CALL_LIBFUNCS): New macro. * config/cris/cris.opt (munaligned-atomic-may-use-library): New option. * config/cris/sync.md ("atomic_fetch_<atomic_op_name><mode>") ("cris_atomic_fetch_<atomic_op_name><mode>_1") ("atomic_compare_and_swap<mode>") ("cris_atomic_compare_and_swap<mode>_1"): Make conditional on TARGET_ATOMICS_MAY_CALL_LIBFUNCS for sizes larger than byte. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189504 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/cris/cris.c')
-rw-r--r--gcc/config/cris/cris.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 44e328bfb2a..71bb2760034 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -2761,6 +2761,16 @@ cris_init_libfuncs (void)
set_optab_libfunc (udiv_optab, SImode, "__Udiv");
set_optab_libfunc (smod_optab, SImode, "__Mod");
set_optab_libfunc (umod_optab, SImode, "__Umod");
+
+ /* Atomic data being unaligned is unfortunately a reality.
+ Deal with it. */
+ if (TARGET_ATOMICS_MAY_CALL_LIBFUNCS)
+ {
+ set_optab_libfunc (sync_compare_and_swap_optab, SImode,
+ "__cris_atcmpxchgr32");
+ set_optab_libfunc (sync_compare_and_swap_optab, HImode,
+ "__cris_atcmpxchgr16");
+ }
}
/* The INIT_EXPANDERS worker sets the per-function-data initializer and