From patchwork Tue Jul 26 09:01:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 3126 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C0C0423F41 for ; Tue, 26 Jul 2011 09:02:00 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 8DB81A184F0 for ; Tue, 26 Jul 2011 09:02:00 +0000 (UTC) Received: by qwb8 with SMTP id 8so137144qwb.11 for ; Tue, 26 Jul 2011 02:02:00 -0700 (PDT) Received: by 10.229.1.217 with SMTP id 25mr1809996qcg.38.1311670920055; Tue, 26 Jul 2011 02:02:00 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs103962qcb; Tue, 26 Jul 2011 02:01:59 -0700 (PDT) Received: by 10.227.162.133 with SMTP id v5mr4653741wbx.14.1311670918941; Tue, 26 Jul 2011 02:01:58 -0700 (PDT) Received: from lon1-post-2.mail.demon.net (lon1-post-2.mail.demon.net [195.173.77.149]) by mx.google.com with ESMTP id ek7si500444wbb.30.2011.07.26.02.01.58; Tue, 26 Jul 2011 02:01:58 -0700 (PDT) Received-SPF: neutral (google.com: 195.173.77.149 is neither permitted nor denied by best guess record for domain of david.gilbert@linaro.org) client-ip=195.173.77.149; Authentication-Results: mx.google.com; spf=neutral (google.com: 195.173.77.149 is neither permitted nor denied by best guess record for domain of david.gilbert@linaro.org) smtp.mail=david.gilbert@linaro.org Received: from tu006.demon.co.uk ([83.105.84.125] helo=gort.home.treblig.org) by lon1-post-2.mail.demon.net with esmtp (Exim 4.69) id 1QldWY-0007Bi-al; Tue, 26 Jul 2011 09:01:58 +0000 Received: from [192.168.66.106] (helo=davesworkthinkpad) by gort.home.treblig.org with esmtp (Exim 4.72) (envelope-from ) id 1QldWX-0001BG-Il; Tue, 26 Jul 2011 10:01:57 +0100 Date: Tue, 26 Jul 2011 10:01:57 +0100 From: "Dr. David Alan Gilbert" To: gcc-patches@gcc.gnu.org Cc: ramana.radhakrishnan@linaro.org, rth@redhat.com, joseph@codesourcery.com, patches@linaro.org Subject: [Patch 3/4] ARM 64 bit sync atomic operations [V2] Message-ID: <20110726090156.GD6925@davesworkthinkpad> References: <20110701155254.GA5242@davesworkthinkpad> <20110726085910.GA6925@davesworkthinkpad> <20110726090039.GB6925@davesworkthinkpad> <20110726090115.GC6925@davesworkthinkpad> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110726090115.GC6925@davesworkthinkpad> User-Agent: Mutt/1.5.20 (2009-06-14) 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. gcc/ * config/arm/arm.c (arm_output_sync_loop): Move label before barier, fixes PR/48126 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 28be078..cee3471 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -23780,8 +23780,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