From patchwork Mon Jul 16 03:43:09 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: 171122 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 DE7202C00FF for ; Mon, 16 Jul 2012 13:43:37 +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=1343015018; 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=pCmPJlT66l7ZQJy0f4k3 9SMWqIg=; b=OUncggnvu87YI1RXsfBKsn2kNwQbI53Y14s62A25btRcsqq7GAbM IMW6xL3qwCuq2nackk8YszG5kmGxdqb0FU4UGj2JBi0/YOECv59hh65MpP+tjGwF ejksaYqOkissfxc1SXfYubPqAScu4U2bm7OfrGJf4najijY6NdwUrj8= 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=GyTcbo6xKXDtKOKu2qEpPXYGqzo0ITmW7Dcthb07UYUg8mxK+8nXC0egY5pgwt NU0Te/sV/HT7wpXbV+iHB69bRnAJqFxqbn19+spa5aiHjN+bGYx9cS09/PlzhBwe 11e+3l2aXS/l6Io7d733m8GroWaXs8oTMgEn0LwuTlzNk=; Received: (qmail 10744 invoked by alias); 16 Jul 2012 03:43:32 -0000 Received: (qmail 10733 invoked by uid 22791); 16 Jul 2012 03:43:28 -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:43:12 +0000 Received: from localhost (localhost [127.0.0.1]) by ra.se.axis.com (Postfix) with ESMTP id CB30711FBA for ; Mon, 16 Jul 2012 05:43:11 +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 WPxWVjZnqqie for ; Mon, 16 Jul 2012 05:43:11 +0200 (CEST) Received: from thoth.se.axis.com (thoth.se.axis.com [10.0.2.173]) by ra.se.axis.com (Postfix) with ESMTP id 26CDF11FB6 for ; Mon, 16 Jul 2012 05:43:11 +0200 (CEST) Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.88.21.50]) by thoth.se.axis.com (Postfix) with ESMTP id 24E583413D; Mon, 16 Jul 2012 05:43: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 q6G3hB75019625; Mon, 16 Jul 2012 05:43:11 +0200 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id q6G3h9Pp019619; Mon, 16 Jul 2012 05:43:09 +0200 Date: Mon, 16 Jul 2012 05:43:09 +0200 Message-Id: <201207160343.q6G3h9Pp019619@ignucius.se.axis.com> From: Hans-Peter Nilsson To: gcc-patches@gcc.gnu.org Subject: CRIS atomics revisited 2/4: don't allow a memory operand (with possible side-effects) 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 Buglet in "atomic_compare_and_swap", allowing (in theory) a volatile or post-increment memory operand. Simplest and safest fixed by excluding all memory operands. gcc: * config/cris/sync.md ("atomic_compare_and_swap"): Change predicate to nonmemory_operand for operand 3. Add FIXME. ("cris_atomic_compare_and_swap_1"): Change predicates and constraints for operand 3 to exclude memory. brgds, H-P Index: config/cris/sync.md =================================================================== --- config/cris/sync.md (revision 189500) +++ config/cris/sync.md (working copy) @@ -184,11 +184,12 @@ (define_insn "cris_atomic_fetch_ over this, but having both would be ;; redundant. +;; FIXME: handle memory without side-effects for operand[3]. (define_expand "atomic_compare_and_swap" [(match_operand:SI 0 "register_operand") (match_operand:BWD 1 "register_operand") (match_operand:BWD 2 "memory_operand") - (match_operand:BWD 3 "general_operand") + (match_operand:BWD 3 "nonmemory_operand") (match_operand:BWD 4 "register_operand") (match_operand 5) (match_operand 6) @@ -218,7 +219,7 @@ (define_insn "cris_atomic_compare_and_sw [(set (match_operand:SI 0 "register_operand" "=&r") (unspec_volatile:SI [(match_operand:BWD 2 "memory_operand" "+Q") - (match_operand:BWD 3 "general_operand" "g")] + (match_operand:BWD 3 "nonmemory_operand" "ri")] CRIS_UNSPEC_ATOMIC_SWAP_BOOL)) (set (match_operand:BWD 1 "register_operand" "=&r") (match_dup 2)) (set (match_dup 2)