[PATCH] Fix errors in expand_atomic_store.
Richard Henderson
rth@redhat.com
Tue Nov 1 04:50:00 GMT 2011
* optabs.c (expand_atomic_store): Use create_fixed_operand for
atomic_store optab. Don't try to fall back to sync_lock_release.
---
The create_fixed_operand thinko is obvious. The sync_lock_release is
more subtle. The target is allowed to support only storing 0/1 with
the test_and_set/lock_release pair, and it's allowed to support that
in non-obvious ways. We don't want to get involved in that.
r~
---
gcc/ChangeLog.mm | 5 +++++
gcc/optabs.c | 21 +--------------------
2 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 1ecab53..d8ab97e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7118,32 +7118,13 @@ expand_atomic_store (rtx mem, rtx val, enum memmodel model)
icode = direct_optab_handler (atomic_store_optab, mode);
if (icode != CODE_FOR_nothing)
{
-
- create_output_operand (&ops[0], mem, mode);
+ create_fixed_operand (&ops[0], mem);
create_input_operand (&ops[1], val, mode);
create_integer_operand (&ops[2], model);
if (maybe_expand_insn (icode, 3, ops))
return const0_rtx;
}
- /* A store of 0 is the same as __sync_lock_release, try that. */
- if (CONST_INT_P (val) && INTVAL (val) == 0)
- {
- icode = direct_optab_handler (sync_lock_release_optab, mode);
- if (icode != CODE_FOR_nothing)
- {
- create_fixed_operand (&ops[0], mem);
- create_input_operand (&ops[1], const0_rtx, mode);
- if (maybe_expand_insn (icode, 2, ops))
- {
- /* lock_release is only a release barrier. */
- if (model == MEMMODEL_SEQ_CST)
- expand_builtin_mem_thread_fence (model);
- return const0_rtx;
- }
- }
- }
-
/* If the size of the object is greater than word size on this target,
a default store will not be atomic, Try a mem_exchange and throw away
the result. If that doesn't work, don't do anything. */
--
1.7.6.4
More information about the Gcc-patches
mailing list