Commit a96297a2 by Matthew Wahab Committed by Matthew Wahab

re PR target/65697 (__atomic memory barriers not strong enough for __sync builtins)

2015-06-29  Matthew Wahab  <matthew.wahab@arm.com>

	PR target/65697
	* config/armc/arm.c (arm_split_compare_and_swap): For ARMv8, replace an
	initial acquire barrier with final barrier.

From-SVN: r225133
parent 6b3a1ce9
2015-06-29 Matthew Wahab <matthew.wahab@arm.com> 2015-06-29 Matthew Wahab <matthew.wahab@arm.com>
PR target/65697 PR target/65697
* config/armc/arm.c (arm_split_compare_and_swap): For ARMv8, replace an
initial acquire barrier with final barrier.
2015-06-29 Matthew Wahab <matthew.wahab@arm.com>
PR target/65697
* config/armc/arm.c (arm_split_atomic_op): For ARMv8, replace an * config/armc/arm.c (arm_split_atomic_op): For ARMv8, replace an
initial acquire barrier with final barrier. initial acquire barrier with final barrier.
......
...@@ -27614,6 +27614,8 @@ arm_split_compare_and_swap (rtx operands[]) ...@@ -27614,6 +27614,8 @@ arm_split_compare_and_swap (rtx operands[])
scratch = operands[7]; scratch = operands[7];
mode = GET_MODE (mem); mode = GET_MODE (mem);
bool is_armv8_sync = arm_arch8 && is_mm_sync (mod_s);
bool use_acquire = TARGET_HAVE_LDACQ bool use_acquire = TARGET_HAVE_LDACQ
&& !(is_mm_relaxed (mod_s) || is_mm_consume (mod_s) && !(is_mm_relaxed (mod_s) || is_mm_consume (mod_s)
|| is_mm_release (mod_s)); || is_mm_release (mod_s));
...@@ -27622,6 +27624,11 @@ arm_split_compare_and_swap (rtx operands[]) ...@@ -27622,6 +27624,11 @@ arm_split_compare_and_swap (rtx operands[])
&& !(is_mm_relaxed (mod_s) || is_mm_consume (mod_s) && !(is_mm_relaxed (mod_s) || is_mm_consume (mod_s)
|| is_mm_acquire (mod_s)); || is_mm_acquire (mod_s));
/* For ARMv8, the load-acquire is too weak for __sync memory orders. Instead,
a full barrier is emitted after the store-release. */
if (is_armv8_sync)
use_acquire = false;
/* Checks whether a barrier is needed and emits one accordingly. */ /* Checks whether a barrier is needed and emits one accordingly. */
if (!(use_acquire || use_release)) if (!(use_acquire || use_release))
arm_pre_atomic_barrier (mod_s); arm_pre_atomic_barrier (mod_s);
...@@ -27662,7 +27669,8 @@ arm_split_compare_and_swap (rtx operands[]) ...@@ -27662,7 +27669,8 @@ arm_split_compare_and_swap (rtx operands[])
emit_label (label2); emit_label (label2);
/* Checks whether a barrier is needed and emits one accordingly. */ /* Checks whether a barrier is needed and emits one accordingly. */
if (!(use_acquire || use_release)) if (is_armv8_sync
|| !(use_acquire || use_release))
arm_post_atomic_barrier (mod_s); arm_post_atomic_barrier (mod_s);
if (is_mm_relaxed (mod_f)) if (is_mm_relaxed (mod_f))
......
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