From patchwork Mon Feb 27 00:31:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 143141 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 79D23B6FBD for ; Mon, 27 Feb 2012 11:31:43 +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=1330907504; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Subject:From:To:Content-Type:Date:Message-ID:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=2QSTD7Iy2XJ7hy8FMJxR Qqv2o7Y=; b=oNef4pr+6n2Ph4GIF6SwpXfx9KTCVs/hu5eznlJz02SveJu04498 xxuIroAKiHSDAcbsTIt34cMgHqKsw6yDtvozCt0AjnvE00SH961ewGvTWS5n7vl5 8QFuz1apkic0qlSNbJrF8Dl/RXYKvusfGusXcWY0K9KnlUOOY1DQSzQ= 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:Subject:From:To:Content-Type:Date:Message-ID:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=w4ycVEuVjgoZWpnifNGIJpd/i6T/uIVjDGakRZFq7fAPdakd2VW+D6P16OVkCo tHs6+1dsEcyAl1woOU01mDo58n52ZfhSJ+8OfgKJ+haYJYDc00AqrMG4tRiOwyYS n3WsNQrYRZRGKPhDmxE+3Kx2tnGfRDQXtbd8Y/VTA4GNA=; Received: (qmail 27486 invoked by alias); 27 Feb 2012 00:31:39 -0000 Received: (qmail 27471 invoked by uid 22791); 27 Feb 2012 00:31:38 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout09.t-online.de (HELO mailout09.t-online.de) (194.25.134.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Feb 2012 00:31:23 +0000 Received: from fwd25.aul.t-online.de (fwd25.aul.t-online.de ) by mailout09.t-online.de with smtp id 1S1oUr-000396-CD; Mon, 27 Feb 2012 01:31:21 +0100 Received: from [192.168.0.104] (ZGuUSkZpwh2dHESeLmOTUAKnIjV4BcxQQYLsZOsZKIZUVFfnToBEJtuw9BY0x5wQ3+@[87.157.57.36]) by fwd25.t-online.de with esmtp id 1S1oUo-1EMe5Q0; Mon, 27 Feb 2012 01:31:18 +0100 Subject: [SH] Use SImode for return value in atomic_compare_and_swap* From: Oleg Endo To: gcc-patches Date: Mon, 27 Feb 2012 01:31:14 +0100 Message-ID: <1330302674.2929.106.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 Hello, The attached patch changes the atomic_compare_and_swap expander/insn to use SImode for the return value instead of QImode. This is more aligned to the other insns which handle the T bit as SImode and avoids some unnecessary test instructions in cases where the result of the atomic op in the T bit is re-used. Tested against rev 184582 with make -k check RUNTESTFLAGS="--target_board=sh-sim \{-m2/-ml/-msoft-atomic, -m2/-mb/-msoft-atomic, -m2a-single/-mb/-msoft-atomic, -m4-single/-ml/-msoft-atomic, -m4-single/-mb/-msoft-atomic, -m4a-single/-ml/-msoft-atomic, -m4a-single/-mb/-msoft-atomic}" and no new failures. Cheers, Oleg 2012-02-27 Oleg Endo * config/sh/sync.md (atomic_compare_and_swap): Use SImode for return value instead of QImode. (atomic_compare_and_swap_soft): Likewise. Index: gcc/config/sh/sync.md =================================================================== --- gcc/config/sh/sync.md (revision 184582) +++ gcc/config/sh/sync.md (working copy) @@ -109,7 +109,7 @@ [(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")]) (define_expand "atomic_compare_and_swap" - [(match_operand:QI 0 "register_operand" "") ;; bool success output + [(match_operand:SI 0 "register_operand" "") ;; bool success output (match_operand:I124 1 "register_operand" "") ;; oldval output (match_operand:I124 2 "memory_operand" "") ;; memory (match_operand:I124 3 "register_operand" "") ;; expected input @@ -131,7 +131,7 @@ else if (mode == HImode) emit_insn (gen_zero_extendhisi2 (gen_lowpart (SImode, operands[1]), operands[1])); - emit_insn (gen_movqi (operands[0], gen_rtx_REG (QImode, T_REG))); + emit_insn (gen_movsi (operands[0], gen_rtx_REG (SImode, T_REG))); DONE; }) @@ -144,8 +144,8 @@ UNSPECV_CMPXCHG_1)) (set (mem:I124 (match_dup 1)) (unspec_volatile:I124 [(const_int 0)] UNSPECV_CMPXCHG_2)) - (set (reg:QI T_REG) - (unspec_volatile:QI [(const_int 0)] UNSPECV_CMPXCHG_3)) + (set (reg:SI T_REG) + (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3)) (clobber (match_scratch:SI 4 "=&u")) (clobber (reg:SI R0_REG)) (clobber (reg:SI R1_REG))]