From patchwork Mon Nov 8 07:44:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaushik Phatak X-Patchwork-Id: 70403 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 F13BFB70F4 for ; Mon, 8 Nov 2010 18:45:23 +1100 (EST) Received: (qmail 30976 invoked by alias); 8 Nov 2010 07:45:18 -0000 Received: (qmail 30964 invoked by uid 22791); 8 Nov 2010 07:45:16 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_50 X-Spam-Check-By: sourceware.org Received: from va3ehsobe006.messaging.microsoft.com (HELO VA3EHSOBE009.bigfish.com) (216.32.180.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Nov 2010 07:45:08 +0000 Received: from mail153-va3-R.bigfish.com (10.7.14.238) by VA3EHSOBE009.bigfish.com (10.7.40.29) with Microsoft SMTP Server id 14.1.225.8; Mon, 8 Nov 2010 07:45:06 +0000 Received: from mail153-va3 (localhost.localdomain [127.0.0.1]) by mail153-va3-R.bigfish.com (Postfix) with ESMTP id 1774A19F035F; Mon, 8 Nov 2010 07:45:06 +0000 (UTC) X-SpamScore: -11 X-BigFish: VPS-11(zz936eK154dM4015Lzz1202hzz8275bhz32i2a8h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:Kcinpunhjhc01.kpit.com; RD:Kcinpunhjhc01.kpit.com; EFVD:NLI Received: from mail153-va3 (localhost.localdomain [127.0.0.1]) by mail153-va3 (MessageSwitch) id 1289202305690421_29279; Mon, 8 Nov 2010 07:45:05 +0000 (UTC) Received: from VA3EHSMHS011.bigfish.com (unknown [10.7.14.248]) by mail153-va3.bigfish.com (Postfix) with ESMTP id A45D08C0052; Mon, 8 Nov 2010 07:45:05 +0000 (UTC) Received: from Kcinpunhjhc01.kpit.com (203.197.93.240) by VA3EHSMHS011.bigfish.com (10.7.99.21) with Microsoft SMTP Server (TLS) id 14.1.225.8; Mon, 8 Nov 2010 07:44:59 +0000 Received: from Kcinpunhjcms01.kpit.com ([172.10.16.121]) by Kcinpunhjhc01.kpit.com ([172.10.16.123]) with mapi; Mon, 8 Nov 2010 13:14:57 +0530 From: Kaushik Phatak To: "gcc-patches@gcc.gnu.org" CC: Jeff Law , Prafulla Thakare Date: Mon, 8 Nov 2010 13:14:47 +0530 Subject: RE: [Patch : H8300] Minor bug fix for bit instructions Message-ID: References: <4CCF8AA5.9070901@redhat.com> In-Reply-To: <4CCF8AA5.9070901@redhat.com> MIME-Version: 1.0 X-OriginatorOrg: kpitcummins.com 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 Hi Jeff, Thanks for your detailed review. Please find below an updated patch with the suggested changes, - Changelog more explicit - formatting corrections - Testcase added to gcc.dg Please let me know if these are OK. Thanks, Kaushik Phatak www.kpitgnutools.com Changelog: 2010-11-08 Kaushik Phatak * config/h8300/h8300.md (define_split) : Add condition for "and with single_zero" splitter to handle 16-bit const operands. * config/h8300/h8300.md (define_split) : Add condition for "ior with single_one" splitter to handle 16-bit const operands. * config/h8300/h8300.md (define_split) : Add condition for "xor with single_one" splitter to handle 16-bit const operands. diff -upr trunk.orig/gcc/config/h8300/h8300.md trunk/gcc/config/h8300/h8300.md --- trunk.orig/gcc/config/h8300/h8300.md 2010-08-26 20:55:19.000000000 +0530 +++ trunk/gcc/config/h8300/h8300.md 2010-10-28 19:57:14.000000000 +0530 @@ -1781,8 +1781,17 @@ (and:QI (match_dup 1) (match_dup 2)))] { - operands[0] = adjust_address (operands[0], QImode, 1); - operands[1] = adjust_address (operands[1], QImode, 1); + if (abs (INTVAL (operands[2])) > 0xFF) + { + operands[0] = adjust_address (operands[0], QImode, 0); + operands[1] = adjust_address (operands[1], QImode, 0); + operands[2] = GEN_INT ((INTVAL (operands[2])) >> 8); + } + else + { + operands[0] = adjust_address (operands[0], QImode, 1); + operands[1] = adjust_address (operands[1], QImode, 1); + } }) (define_insn "bclrhi_msx" @@ -1916,8 +1925,17 @@ (ior:QI (match_dup 1) (match_dup 2)))] { - operands[0] = adjust_address (operands[0], QImode, 1); - operands[1] = adjust_address (operands[1], QImode, 1); + if (abs (INTVAL (operands[2])) > 0xFF) + { + operands[0] = adjust_address (operands[0], QImode, 0); + operands[1] = adjust_address (operands[1], QImode, 0); + operands[2] = GEN_INT ((INTVAL (operands[2])) >> 8); + } + else + { + operands[0] = adjust_address (operands[0], QImode, 1); + operands[1] = adjust_address (operands[1], QImode, 1); + } }) (define_insn "bsethi_msx" @@ -1982,8 +2000,17 @@ (xor:QI (match_dup 1) (match_dup 2)))] { - operands[0] = adjust_address (operands[0], QImode, 1); - operands[1] = adjust_address (operands[1], QImode, 1); + if (abs (INTVAL (operands[2])) > 0xFF) + { + operands[0] = adjust_address (operands[0], QImode, 0); + operands[1] = adjust_address (operands[1], QImode, 0); + operands[2] = GEN_INT ((INTVAL (operands[2])) >> 8); + } + else + { + operands[0] = adjust_address (operands[0], QImode, 1); + operands[1] = adjust_address (operands[1], QImode, 1); + } }) (define_insn "bnothi_msx" diff -upN trunk.orig/gcc/testsuite/gcc.dg/h8300-bit-insn-ice.c trunk/gcc/testsuite/gcc.dg/h8300-bit-insn-ice.c --- trunk.orig/gcc/testsuite/gcc.dg/h8300-bit-insn-ice.c 1970-01-01 05:30:00.000000000 +0530 +++ trunk/gcc/testsuite/gcc.dg/h8300-bit-insn-ice.c 2010-11-08 11:43:23.000000000 +0530 @@ -0,0 +1,39 @@ +/* { dg-skip-if "" { "h8300*-*-*" } "*" "-msx*" } */ +/* ICE for bit instruction generation using 16-bit const */ + +__extension__ struct st_mstp +{ + union + { + unsigned short WORD; + struct + { + unsigned char ACSE:1; + unsigned char _EXDMAC:1; + unsigned char _DMAC:1; + unsigned char _DTC:1; + unsigned char:2; + unsigned char _TMR23:1; + unsigned char _TMR01:1; + unsigned char:2; + unsigned char _DA:1; + unsigned char:1; + unsigned char _AD:1; + unsigned char:1; + unsigned char _TPUU:1; + unsigned char _TPUL:1; + } BIT; + } CRA; +}; +#define MSTP (*(volatile struct st_mstp *)0xFFFDC8) +#define MSTPA_EXDMA 0x4000 +#define MSTPA_AND 0xFEFF + +int +main () +{ + MSTP.CRA.WORD |= MSTPA_EXDMA; + MSTP.CRA.WORD ^= MSTPA_EXDMA; + MSTP.CRA.WORD &= MSTPA_AND; + return 0; +}