From patchwork Thu Nov 17 11:07:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 126184 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 BAB94B720C for ; Thu, 17 Nov 2011 22:07:47 +1100 (EST) Received: (qmail 1368 invoked by alias); 17 Nov 2011 11:07:43 -0000 Received: (qmail 1354 invoked by uid 22791); 17 Nov 2011 11:07:42 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_HW X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Nov 2011 11:07:29 +0000 Received: by ggnh4 with SMTP id h4so966279ggn.20 for ; Thu, 17 Nov 2011 03:07:28 -0800 (PST) Received: by 10.236.22.4 with SMTP id s4mr2293696yhs.8.1321528043164; Thu, 17 Nov 2011 03:07:23 -0800 (PST) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id k20sm95117449ann.15.2011.11.17.03.07.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 03:07:19 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 6F6A4170C2BF; Thu, 17 Nov 2011 21:37:13 +1030 (CST) Date: Thu, 17 Nov 2011 21:37:13 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: powerpc lack of memory_barrier Message-ID: <20111117110713.GZ14325@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes 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 Lacking this pattern means the builtin __sync_synchronize() on powerpc is just an asm with a memory clobber (see builtins.c), which is hardly a "full memory barrier" as extend.texi says it should be. This patch fixes multiple libgomp testsuite failures. Bootstrapped and regression tested powerpc-linux. OK for mainline? * config/rs6000/sync.md: Duplicate hwsync as memory_barrier. Index: gcc/config/rs6000/sync.md =================================================================== --- gcc/config/rs6000/sync.md (revision 181425) +++ gcc/config/rs6000/sync.md (working copy) @@ -53,6 +53,15 @@ (define_expand "mem_thread_fence" DONE; }) +(define_expand "memory_barrier" + [(set (match_dup 0) + (unspec:BLK [(match_dup 0)] UNSPEC_SYNC))] + "" +{ + operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); + MEM_VOLATILE_P (operands[0]) = 1; +}) + (define_expand "hwsync" [(set (match_dup 0) (unspec:BLK [(match_dup 0)] UNSPEC_SYNC))]