From patchwork Sun Sep 29 17:53:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 278879 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1B6662C00E7 for ; Mon, 30 Sep 2013 03:55:18 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=e/G4oveM9l0DjK07 exQUFb8u0RpNPUZ3mN/+Ay1Sx7zuXbdhYTm6Vl31v6t2YG1kUwDooT+RF3c06Eay YkZbzPpPBgupH+QLukN2OqltQKl+M6WNrCI4hVHrRtG+3OsFHvZDRxYNuqUpNya4 NE3IISPmKNsOYyMxezRxbfJhL0A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=jfduJyc+M6Loa5xYP7CG/N wxmPQ=; b=Y//1k71d0x9KXOS6Q9yPrvoymTQBbh+NoKltU0tO9Z95GZVIEaq8VV k5rDAXsneDB20ZbzcRyNyM7ZVT6c+gnP3L/eHOfGLlZk1p/1MuT9KqJl/mxV9sdo HaRziKEdfpzCAjcNoqZwbiTsUpbgrrM9EylwgSKrNGz5rj9d8A+g4= Received: (qmail 4421 invoked by alias); 29 Sep 2013 17:55:13 -0000 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 Received: (qmail 4410 invoked by uid 89); 29 Sep 2013 17:55:12 -0000 Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 29 Sep 2013 17:55:12 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 34EEE26835A8 for ; Sun, 29 Sep 2013 19:55:08 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GNkaXBN5bLxP for ; Sun, 29 Sep 2013 19:55:08 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 16EFA26835A7 for ; Sun, 29 Sep 2013 19:55:07 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Add peephole for memory barriers Date: Sun, 29 Sep 2013 19:53:04 +0200 Message-ID: <6772809.aAVQ9SQRDg@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 This is a bit gross, but this prevents consecutive memory barriers from being generated, for example on accesses to atomic objects in Ada. Tested on SPARC/Solaris, applied on the mainline. 2013-09-29 Eric Botcazou * config/sparc/sync.md: Add peephole for consecutive memory barriers. Index: config/sparc/sync.md =================================================================== --- config/sparc/sync.md (revision 202912) +++ config/sparc/sync.md (working copy) @@ -93,6 +93,18 @@ (define_insn "*membar" "membar\t%1" [(set_attr "type" "multi")]) +(define_peephole2 + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0) (match_operand:SI 1 "const_int_operand")] + UNSPEC_MEMBAR)) + (set (match_operand:BLK 2 "" "") + (unspec:BLK [(match_dup 2) (match_operand:SI 3 "const_int_operand")] + UNSPEC_MEMBAR))] + "" + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0) (match_dup 1)] UNSPEC_MEMBAR))] +{ operands[1] = GEN_INT (UINTVAL (operands[1]) | UINTVAL (operands[3])); }) + (define_expand "atomic_load" [(match_operand:I 0 "register_operand" "") (match_operand:I 1 "memory_operand" "")