diff mbox

[2/5] ARM 64 bit sync atomic operations [V3]

Message ID 20111006175237.GC12770@davesworkthinkpad
State New
Headers show

Commit Message

Dr. David Alan Gilbert Oct. 6, 2011, 5:52 p.m. UTC
Micahel K. Edwards points out in PR/48126 that the sync is in the wrong place
        relative to the branch target of the compare, since the load could float
        up beyond the ldrex.
  
        PR target/48126
    
          * config/arm/arm.c (arm_output_sync_loop): Move label before barrier

Comments

Ramana Radhakrishnan Oct. 12, 2011, 12:44 a.m. UTC | #1
On 6 October 2011 18:52, Dr. David Alan Gilbert
<david.gilbert@linaro.org> wrote:
>        Micahel K. Edwards points out in PR/48126 that the sync is in the wrong place
>        relative to the branch target of the compare, since the load could float
>        up beyond the ldrex.
>
>        PR target/48126
>
>          * config/arm/arm.c (arm_output_sync_loop): Move label before barrier


>
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 5161439..6e7105a 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -24214,8 +24214,11 @@ arm_output_sync_loop (emit_f emit,
>        }
>     }
>
> -  arm_process_output_memory_barrier (emit, NULL);
> +  /* Note: label is before barrier so that in cmp failure case we still get
> +     a barrier to stop subsequent loads floating upwards past the ldrex
> +     pr/48126.  */
>   arm_output_asm_insn (emit, 1, operands, "%sLSYB%%=:", LOCAL_LABEL_PREFIX);
> +  arm_process_output_memory_barrier (emit, NULL);
>  }
>
>  static rtx
>

OK.

Ramana
Ramana Radhakrishnan Oct. 12, 2011, 12:51 a.m. UTC | #2
On 6 October 2011 18:52, Dr. David Alan Gilbert
<david.gilbert@linaro.org> wrote:
>        Micahel K. Edwards points out in PR/48126 that the sync is in the wrong place
>        relative to the branch target of the compare, since the load could float
>        up beyond the ldrex.
>
>        PR target/48126
>
>          * config/arm/arm.c (arm_output_sync_loop): Move label before barrier
>
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 5161439..6e7105a 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -24214,8 +24214,11 @@ arm_output_sync_loop (emit_f emit,
>        }
>     }
>
> -  arm_process_output_memory_barrier (emit, NULL);
> +  /* Note: label is before barrier so that in cmp failure case we still get
> +     a barrier to stop subsequent loads floating upwards past the ldrex
> +     pr/48126.  */

Just one minor nit I just noticed. Please correct this to PR 48126 in
the comment rather than pr/48126.

Otherwise OK.

Ramana
diff mbox

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 5161439..6e7105a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -24214,8 +24214,11 @@  arm_output_sync_loop (emit_f emit,
 	}
     }
 
-  arm_process_output_memory_barrier (emit, NULL);
+  /* Note: label is before barrier so that in cmp failure case we still get
+     a barrier to stop subsequent loads floating upwards past the ldrex
+     pr/48126.  */
   arm_output_asm_insn (emit, 1, operands, "%sLSYB%%=:", LOCAL_LABEL_PREFIX);
+  arm_process_output_memory_barrier (emit, NULL);
 }
 
 static rtx