From patchwork Mon Jul 16 03:42:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 171121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9D5F12C00C4 for ; Mon, 16 Jul 2012 13:42:56 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343014976; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Date:Message-Id:From:To: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=lYvnRn2UYLROAcTBH3fl 3VYb0bs=; b=xOoY4hFxR3k8nkh+yqZi+Ffs2iLwy3IPeXPeF2eLFzIdxt7G5N51 pQvilWMsaSjU0si4mqbohSVltgCvcxwb33TKfvF5euXklvKyS2KWAOSJYT2eKjoG 2CIDh8Q1Ck1jEqXUd09C8eWyAdaQjNFKEr3muWDRg4GoBer/Onr/Izs= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:Received:Date:Message-Id:From:To:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=jzgQ7RaE95jKAQm7+BCm+2VtZT24jRM0+eSneHfnU/rckc3l4OYNdfuo8ztieA JzNZWy2CZG24grt12CYfcBvFwpsiEgbDglF70CWCS2tveNncroTuPRtS6q/X4lGC twzpyxHmN+YNfRzSDsBfb783FCUYpdRlVD0cqlvH7JSx4=; Received: (qmail 10083 invoked by alias); 16 Jul 2012 03:42:50 -0000 Received: (qmail 10045 invoked by uid 22791); 16 Jul 2012 03:42:29 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ra.se.axis.com (HELO ra.se.axis.com) (195.60.68.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jul 2012 03:42:15 +0000 Received: from localhost (localhost [127.0.0.1]) by ra.se.axis.com (Postfix) with ESMTP id 9BC9511FBA for ; Mon, 16 Jul 2012 05:42:12 +0200 (CEST) Received: from ra.se.axis.com ([127.0.0.1]) by localhost (ra.se.axis.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id h9o5Yp2mbWgi for ; Mon, 16 Jul 2012 05:42:11 +0200 (CEST) Received: from seth.se.axis.com (seth.se.axis.com [10.0.2.172]) by ra.se.axis.com (Postfix) with ESMTP id DF9B411FB6 for ; Mon, 16 Jul 2012 05:42:11 +0200 (CEST) Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.88.21.50]) by seth.se.axis.com (Postfix) with ESMTP id CFD073E093; Mon, 16 Jul 2012 05:42:11 +0200 (CEST) Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id q6G3gB75019571; Mon, 16 Jul 2012 05:42:11 +0200 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id q6G3gBS3019567; Mon, 16 Jul 2012 05:42:11 +0200 Date: Mon, 16 Jul 2012 05:42:11 +0200 Message-Id: <201207160342.q6G3gBS3019567@ignucius.se.axis.com> From: Hans-Peter Nilsson To: gcc-patches@gcc.gnu.org Subject: CRIS atomics revisited 1/4: use need_atomic_barrier_p. MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Use the new need_atomic_barrier_p. gcc: * config/cris/sync.md ("atomic_fetch_") ("atomic_compare_and_swap"): Gate expand_mem_thread_fence calls on result of call to need_atomic_barrier_p. brgds, H-P Index: config/cris/sync.md =================================================================== --- config/cris/sync.md (revision 189499) +++ config/cris/sync.md (working copy) @@ -93,11 +93,15 @@ (define_expand "atomic_fetch_mode != QImode && TARGET_TRAP_UNALIGNED_ATOMIC) cris_emit_trap_for_misalignment (operands[1]); - expand_mem_thread_fence (mmodel); + if (need_atomic_barrier_p (mmodel, true)) + expand_mem_thread_fence (mmodel); + emit_insn (gen_cris_atomic_fetch__1 (operands[0], operands[1], operands[2])); - expand_mem_thread_fence (mmodel); + if (need_atomic_barrier_p (mmodel, false)) + expand_mem_thread_fence (mmodel); + DONE; }) @@ -196,13 +200,17 @@ (define_expand "atomic_compare_and_swap< if (mode != QImode && TARGET_TRAP_UNALIGNED_ATOMIC) cris_emit_trap_for_misalignment (operands[2]); - expand_mem_thread_fence (mmodel); + if (need_atomic_barrier_p (mmodel, true)) + expand_mem_thread_fence (mmodel); + emit_insn (gen_cris_atomic_compare_and_swap_1 (operands[0], operands[1], operands[2], operands[3], operands[4])); - expand_mem_thread_fence (mmodel); + if (need_atomic_barrier_p (mmodel, false)) + expand_mem_thread_fence (mmodel); + DONE; })