From patchwork Tue Apr 17 21:08:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 153322 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 3ABC8B7023 for ; Wed, 18 Apr 2012 07:11:10 +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=1335301871; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=GyuZaDO 7WwRimE200k1i5s+1b0Q=; b=Qd3Op+dFqeohOCCXFnzRFvKERxmD+PHFSqJvtn/ rkgbz7cgQ2slPnJii6PDawAluS8xOqvE0fGTkSvcGWhcI6wDQQoyz0Errec4x2Pu icQfBZYnV1sfpjiK0ccCaXSwhq0NNEb9MALnt+8kuprlesSJhiMLohNArijMdFhN r8SY= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=EUBAWXOmdy0KXhV4l8dLY50CpCFLIvPfzqhViSzyO9FwRyh2Rvb3ocjv3sO+nR aKmycRy4mFU4KzHcXKZvEV5HM6NOfjhka4tHNHBqT4HpqEfrMFvt8jGKosTaD8wx xRlvl/t0pY0Rb6iaYbOUv3vXpZFHN9usOB+wv0mvmLaH0=; Received: (qmail 10303 invoked by alias); 17 Apr 2012 21:11:01 -0000 Received: (qmail 10280 invoked by uid 22791); 17 Apr 2012 21:10:59 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Apr 2012 21:10:44 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SKFff-0005zB-3c from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Tue, 17 Apr 2012 14:10:43 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 17 Apr 2012 14:10:41 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.1.289.1; Tue, 17 Apr 2012 22:10:39 +0100 Message-ID: <4F8DDBC3.4060905@codesourcery.com> Date: Tue, 17 Apr 2012 23:08:19 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110920 Lightning/1.0b3pre Thunderbird/3.1.12 MIME-Version: 1.0 To: GCC Patches Subject: Wider modes for partial int modes 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 This patch enables GET_MODE_WIDER_MODE for MODE_PARTIAL_INT (by setting the wider mode to the one the partial mode is based on), which is useful for the port I'm working on: I can avoid defining operations on the partial modes. Also, convert_modes is changed so that unsignedp is taken into account when widening partial modes. I've tested this on m32c-elf as well as on my port, and bootstrapped on i686-linux. Ok? Bernd * machmode.h (CLASS_HAS_WIDER_MODES_P): True for MODE_PARTIAL_INT. * expr.c (convert_move): Honor unsignedp when extending partial int modes. * genmodes.c (power_of_two_p, regular_mode, make_complex_modes, emit_mode_wider): Revert Spider hacks. (complete_mode): Don't clear component field of partial int modes. (emit_mode_inner): Don't emit it however. (calc_wider_mode): Partial int modes widen to their component. Index: machmode.h =================================================================== --- machmode.h (revision 186270) +++ machmode.h (working copy) @@ -166,6 +166,7 @@ extern const unsigned char mode_class[NU /* Nonzero if CLASS modes can be widened. */ #define CLASS_HAS_WIDER_MODES_P(CLASS) \ (CLASS == MODE_INT \ + || CLASS == MODE_PARTIAL_INT \ || CLASS == MODE_FLOAT \ || CLASS == MODE_DECIMAL_FLOAT \ || CLASS == MODE_COMPLEX_FLOAT \ Index: expr.c =================================================================== --- expr.c (revision 186270) +++ expr.c (working copy) @@ -438,21 +438,20 @@ convert_move (rtx to, rtx from, int unsi rtx new_from; enum machine_mode full_mode = smallest_mode_for_size (GET_MODE_BITSIZE (from_mode), MODE_INT); + convert_optab ctab = unsignedp ? zext_optab : sext_optab; + enum insn_code icode; - gcc_assert (convert_optab_handler (sext_optab, full_mode, from_mode) - != CODE_FOR_nothing); + icode = convert_optab_handler (ctab, full_mode, from_mode); + gcc_assert (icode != CODE_FOR_nothing); if (to_mode == full_mode) { - emit_unop_insn (convert_optab_handler (sext_optab, full_mode, - from_mode), - to, from, UNKNOWN); + emit_unop_insn (icode, to, from, UNKNOWN); return; } new_from = gen_reg_rtx (full_mode); - emit_unop_insn (convert_optab_handler (sext_optab, full_mode, from_mode), - new_from, from, UNKNOWN); + emit_unop_insn (icode, new_from, from, UNKNOWN); /* else proceed to integer conversions below. */ from_mode = full_mode; Index: genmodes.c =================================================================== --- genmodes.c (revision 186270) +++ genmodes.c (working copy) @@ -360,7 +360,6 @@ complete_mode (struct mode_data *m) m->bytesize = m->component->bytesize; m->ncomponents = 1; - m->component = 0; /* ??? preserve this */ break; case MODE_COMPLEX_INT: @@ -823,7 +822,13 @@ calc_wider_mode (void) sortbuf[i] = 0; for (j = 0; j < i; j++) - sortbuf[j]->next = sortbuf[j]->wider = sortbuf[j + 1]; + { + sortbuf[j]->next = sortbuf[j + 1]; + if (c == MODE_PARTIAL_INT) + sortbuf[j]->wider = sortbuf[j]->component; + else + sortbuf[j]->wider = sortbuf[j]->next; + } modes[c] = sortbuf[0]; } @@ -1120,7 +1125,8 @@ emit_mode_inner (void) for_all_modes (c, m) tagged_printf ("%smode", - m->component ? m->component->name : void_mode->name, + c != MODE_PARTIAL_INT && m->component + ? m->component->name : void_mode->name, m->name); print_closer ();