From patchwork Sun Dec 16 10:21:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 206671 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 6C5742C0082 for ; Sun, 16 Dec 2012 21:26:39 +1100 (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=1356258401; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=1OpLQqWyc7gSWJfTiKF9y830y7Q=; b=MArlQb+bS7hZUGKmbuh5YQ3vXOj46yH6LfzlGXEQvsSr0Dq3Ae4hnqhn/c2Osf S/29zclhBwisHpRAiH0ctVXKICf9G11zufnJXmTVLTMxBIq0VV9i2/BalZx5K5AL On/iNwg444t72PsR3KEQ3j+6GdGAigGbA9HfmrhxkYhmk= 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:From:To:Cc:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=O2YTDVXuMnjnqS4a2KSheFozf8L4NqISMWWVnhjkBw5t0TmQj7UeAuX3i5Mn3o tPahXojOTkWjjNCcmh/6ND4PDuhb8S6/tI5k05gn5kA/e10yAHAnt5If2ARtXCNP 3vTRqga467QVel+OsQ+Ob2jdWpaK/3lijbkdU0aEeLbKA=; Received: (qmail 27951 invoked by alias); 16 Dec 2012 10:26:35 -0000 Received: (qmail 27927 invoked by uid 22791); 16 Dec 2012 10:26:35 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Dec 2012 10:26:31 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 742FB290034; Sun, 16 Dec 2012 11:26:36 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pJKnAzaUgXKe; Sun, 16 Dec 2012 11:26:36 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 35E97CB3D94; Sun, 16 Dec 2012 11:26:36 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Cc: tomash.brechko@gmail.com Subject: [SPARC] Fix PR target/55673 Date: Sun, 16 Dec 2012 11:21:39 +0100 Message-ID: <4254512.5I2cKQ6HIX@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) 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 As reported by Tomash, the handling of the before and after cases is reversed in sparc_emit_membar_for_model. Moreover, there is a pasto in sync.md that disables the atomic_store expander. Tested on SPARC/Linux, applied on the mainline and 4.7 branch. 2012-12-16 Eric Botcazou Tomash Brechko PR target/55673 * config/sparc/sparc.c (sparc_emit_membar_for_model): Fix reversed handling of before and after cases. * config/sparc/sync.md (atomic_store): Fix pasto. Index: config/sparc/sync.md =================================================================== --- config/sparc/sync.md (revision 194517) +++ config/sparc/sync.md (working copy) @@ -35,8 +35,7 @@ (define_expand "mem_thread_fence" (define_expand "membar" [(set (match_dup 1) - (unspec:BLK [(match_dup 1) - (match_operand:SI 0 "const_int_operand")] + (unspec:BLK [(match_dup 1) (match_operand:SI 0 "const_int_operand")] UNSPEC_MEMBAR))] "TARGET_V8 || TARGET_V9" { @@ -66,7 +65,7 @@ (define_insn "*membar_storestore" "stbar" [(set_attr "type" "multi")]) -;; For V8, LDSTUB has the effect of membar #StoreLoad +;; For V8, LDSTUB has the effect of membar #StoreLoad. (define_insn "*membar_storeload" [(set (match_operand:BLK 0 "" "") (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] @@ -123,8 +122,8 @@ (define_insn "atomic_loaddi_1" [(set_attr "type" "load,fpload")]) (define_expand "atomic_store" - [(match_operand:I 0 "register_operand" "") - (match_operand:I 1 "memory_operand" "") + [(match_operand:I 0 "memory_operand" "") + (match_operand:I 1 "register_operand" "") (match_operand:SI 2 "const_int_operand" "")] "" { Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 194517) +++ config/sparc/sparc.c (working copy) @@ -11190,26 +11190,26 @@ sparc_emit_membar_for_model (enum memmod if (before_after & 1) { - if (model == MEMMODEL_ACQUIRE - || model == MEMMODEL_ACQ_REL - || model == MEMMODEL_SEQ_CST) + if (model == MEMMODEL_RELEASE + || model == MEMMODEL_ACQ_REL + || model == MEMMODEL_SEQ_CST) { if (load_store & 1) - mm |= LoadLoad | LoadStore; + mm |= LoadLoad | StoreLoad; if (load_store & 2) - mm |= StoreLoad | StoreStore; + mm |= LoadStore | StoreStore; } } if (before_after & 2) { - if (model == MEMMODEL_RELEASE + if (model == MEMMODEL_ACQUIRE || model == MEMMODEL_ACQ_REL || model == MEMMODEL_SEQ_CST) { if (load_store & 1) - mm |= LoadLoad | StoreLoad; + mm |= LoadLoad | LoadStore; if (load_store & 2) - mm |= LoadStore | StoreStore; + mm |= StoreLoad | StoreStore; } }