From patchwork Fri Oct 29 14:17:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaushik Phatak X-Patchwork-Id: 69591 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 5F9DAB70DE for ; Sat, 30 Oct 2010 01:18:38 +1100 (EST) Received: (qmail 28014 invoked by alias); 29 Oct 2010 14:18:34 -0000 Received: (qmail 27775 invoked by uid 22791); 29 Oct 2010 14:18:32 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from db3ehsobe004.messaging.microsoft.com (HELO DB3EHSOBE004.bigfish.com) (213.199.154.142) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Oct 2010 14:18:24 +0000 Received: from mail25-db3-R.bigfish.com (10.3.81.244) by DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id 14.1.225.8; Fri, 29 Oct 2010 14:18:20 +0000 Received: from mail25-db3 (localhost.localdomain [127.0.0.1]) by mail25-db3-R.bigfish.com (Postfix) with ESMTP id 17DCE4407DA; Fri, 29 Oct 2010 14:18:20 +0000 (UTC) X-SpamScore: -7 X-BigFish: VPS-7(zz936eK154dMzz1202hzz8275bhz32i2a8h43h61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 0, Received: from mail25-db3 (localhost.localdomain [127.0.0.1]) by mail25-db3 (MessageSwitch) id 1288361862934071_6612; Fri, 29 Oct 2010 14:17:42 +0000 (UTC) Received: from DB3EHSMHS010.bigfish.com (unknown [10.3.81.248]) by mail25-db3.bigfish.com (Postfix) with ESMTP id A16687B8057; Fri, 29 Oct 2010 14:17:42 +0000 (UTC) Received: from kcinpunhjhc02.kpit.com (220.225.38.51) by DB3EHSMHS010.bigfish.com (10.3.87.110) with Microsoft SMTP Server (TLS) id 14.0.482.44; Fri, 29 Oct 2010 14:17:41 +0000 Received: from Kcinpunhjcms01.kpit.com ([172.10.16.121]) by kcinpunhjhc02.kpit.com ([172.10.16.124]) with mapi; Fri, 29 Oct 2010 19:47:36 +0530 From: Kaushik Phatak To: "gcc-patches@gcc.gnu.org" CC: Jeff Law , Prafulla Thakare Date: Fri, 29 Oct 2010 19:47:35 +0530 Subject: [Patch : H8300] Minor bug fix for bit instructions Message-ID: MIME-Version: 1.0 X-Reverse-DNS: unknown 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, The patch below fixes an ICE caused when 16-bit constants are used as operand 2 in logical operation. MSTP.CRA.WORD |= 0x40; -> This is OK MSTP.CRA.WORD |= 0x4000; -> This generates ICE Operand 2 is right shifted by 8 so that it is in valid range to perform bit-operation in QI mode. The 'abs' is used for specific cases for constants like 0xFEFF (-257). Regression done for h8300-elf-* and no new regressions found. Please comment. Regards, Kaushik Phatak www.kpitgnutools.com Changelog: 2010-10-29 Kaushik Phatak * config/h8300/h8300.md (define_splits) : Add condition for 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"