From patchwork Sun Dec 18 00:15:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaz Kojima X-Patchwork-Id: 132027 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 D107EB6FA1 for ; Sun, 18 Dec 2011 11:16:18 +1100 (EST) Received: (qmail 4434 invoked by alias); 18 Dec 2011 00:16:13 -0000 Received: (qmail 4422 invoked by uid 22791); 18 Dec 2011 00:16:10 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mo11.iij4u.or.jp (HELO mo.iij4u.or.jp) (210.138.174.79) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Dec 2011 00:15:52 +0000 Received: by mo.iij4u.or.jp (mo11) id pBI0FoEj014651; Sun, 18 Dec 2011 09:15:50 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox11) id pBI0Fo0F032056; Sun, 18 Dec 2011 09:15:50 +0900 Date: Sun, 18 Dec 2011 09:15:49 +0900 (JST) Message-Id: <20111218.091549.446387858.kkojima@rr.iij4u.or.jp> To: oleg.endo@t-online.de Cc: gcc-patches@gcc.gnu.org Subject: Re: [patch committed SH] Add atomic patterns From: Kaz Kojima In-Reply-To: <1324152819.18753.322.camel@yam-132-YW-E178-FTW> References: <20111205.080727.470553350.kkojima@rr.iij4u.or.jp> <1324141935.18753.306.camel@yam-132-YW-E178-FTW> <1324152819.18753.322.camel@yam-132-YW-E178-FTW> Mime-Version: 1.0 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 Oleg Endo wrote: > The attached patch should fix the align 2 issues mentioned before and > also fixes the ior fetchop_name. It should be "or" instead of "ior". You are right about that nop shouldn't be inserted after write-back. Thanks for pointing out my thinko. Your patch doesn't work because SH soft atomic sequences have another constraint that label 1 should have been 4-byte aligned. And fetchop_name for the logical or operation uses ior instead of or. See genoptint.c, for example. So fixed thusly, though I'd like to commit it with fixing double-quote issues rth pointed out. Regards, kaz --- * config/sh/sync.md (atomic_compare_and_swap_soft): Don't insert nop after the write-back instruction. (atomic_fetch__soft): Likewise. (atomic_fetch_nand_soft): Likewise. (atomic__fetch_soft): Likewise. (atomic_nand_fetch_soft): Likewise. --- ORIG/trunk/gcc/config/sh/sync.md 2011-12-05 10:04:44.000000000 +0900 +++ trunk/gcc/config/sh/sync.md 2011-12-18 07:21:56.000000000 +0900 @@ -88,7 +88,8 @@ "* { return \"\\ -mova\\t1f, r0\\n\\ +.align\\t2\\n\\ +\\tmova\\t1f, r0\\n\\ \\t\\t%2, %4\\n\\ \\tmov\\tr15, r1\\n\\ \\tmov\\t#(0f-1f), r15\\n\\ @@ -96,7 +97,6 @@ mova\\t1f, r0\\n\\ \\tcmp/eq\\t%0, %4\\n\\ \\tbf\\t1f\\n\\ \\tmov.\\t%3, @%1\\n\\ -\\t.align\\t2\\n\\ 1:\\tmov\tr1, r15\"; }" [(set_attr "length" "20")]) @@ -141,17 +141,18 @@ mova\\t1f, r0\\n\\ "* { return \"\\ -mova\\t1f, r0\\n\\ +.align\\t2\\n\\ +\\tmova\\t1f, r0\\n\\ +\\tnop\\n\\ \\tmov\\tr15, r1\\n\\ \\tmov\\t#(0f-1f), r15\\n\\ 0:\\tmov.\\t@%1, %0\\n\\ \\tmov\\t%0, %3\\n\\ \\t\\t%2, %3\\n\\ \\tmov.\\t%3, @%1\\n\\ -\\t.align\\t2\\n\\ 1:\\tmov\tr1, r15\"; }" - [(set_attr "length" "18")]) + [(set_attr "length" "20")]) (define_expand "atomic_fetch_nand" [(set (match_operand:I124 0 "register_operand" "") @@ -193,7 +194,8 @@ mova\\t1f, r0\\n\\ "* { return \"\\ -mova\\t1f, r0\\n\\ +.align\\t2\\n\\ +\\tmova\\t1f, r0\\n\\ \\tmov\\tr15, r1\\n\\ \\tmov\\t#(0f-1f), r15\\n\\ 0:\\tmov.\\t@%1, %0\\n\\ @@ -201,7 +203,6 @@ mova\\t1f, r0\\n\\ \\tand\\t%0, %3\\n\\ \\tnot\\t%3, %3\\n\\ \\tmov.\\t%3, @%1\\n\\ -\\t.align\\t2\\n\\ 1:\\tmov\tr1, r15\"; }" [(set_attr "length" "20")]) @@ -247,13 +248,13 @@ mova\\t1f, r0\\n\\ "* { return \"\\ -mova\\t1f, r0\\n\\ +.align\\t2\\n\\ +\\tmova\\t1f, r0\\n\\ \\tmov\\tr15, r1\\n\\ \\tmov\\t#(0f-1f), r15\\n\\ 0:\\tmov.\\t@%1, %0\\n\\ \\t\\t%2, %0\\n\\ \\tmov.\\t%0, @%1\\n\\ -\\t.align\\t2\\n\\ 1:\\tmov\tr1, r15\"; }" [(set_attr "length" "16")]) @@ -299,14 +300,15 @@ mova\\t1f, r0\\n\\ "* { return \"\\ -mova\\t1f, r0\\n\\ +.align\\t2\\n\\ +\\tmova\\t1f, r0\\n\\ +\\tnop\\n\\ \\tmov\\tr15, r1\\n\\ \\tmov\\t#(0f-1f), r15\\n\\ 0:\\tmov.\\t@%1, %0\\n\\ \\tand\\t%2, %0\\n\\ \\tnot\\t%0, %0\\n\\ \\tmov.\\t%0, @%1\\n\\ -\\t.align\\t2\\n\\ 1:\\tmov\tr1, r15\"; }" - [(set_attr "length" "18")]) + [(set_attr "length" "20")])