From patchwork Tue Jun 24 23:39:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 363771 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5D3371400D5 for ; Wed, 25 Jun 2014 09:39:59 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:in-reply-to:subject:references; q=dns; s= default; b=bU3PDYDfhLFfe/cWpkFf0c4WSpZXJ2H31nCBtH9+pSXncTDYH8/e8 schy2ggfXl7vib4omXDl92dl5OFDEknpygQocwcsy0sf1VNZ81RLZQzUxpCIzBN9 1Te3kxKJB5MrHQaPDyenlrydNaYhe1SypRy283FjEzaVC4mrrf8HUo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:in-reply-to:subject:references; s=default; bh=xYH8xY1+dRrCN4LyJssrlD7nAHA=; b=yvCniqrpUE7UnfuLG3vbmyxil77j YY8VLEstU4ogyq8pZLx34vORA7KOOUUORu7ZCKAVSjy5mvHQU/f/gux4uXZ9hV/9 bDSCthx71u6/43BjMZSgzTEA5zEZUfuU/0g3wiM2TbLTAVTDKx11JLUDPuGtpRJ9 nDUENjaiX+WpYWA= Received: (qmail 3075 invoked by alias); 24 Jun 2014 23:39:53 -0000 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 Received: (qmail 3066 invoked by uid 89); 24 Jun 2014 23:39:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 24 Jun 2014 23:39:52 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5ONdn6j006455 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 24 Jun 2014 19:39:50 -0400 Received: from greed.delorie.com ([10.3.113.17]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5ONdmcG020988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 24 Jun 2014 19:39:49 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id s5ONdmD7012978 for ; Tue, 24 Jun 2014 19:39:48 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id s5ONdlX9012977; Tue, 24 Jun 2014 19:39:47 -0400 Date: Tue, 24 Jun 2014 19:39:47 -0400 Message-Id: <201406242339.s5ONdlX9012977@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org In-reply-to: (joseph@codesourcery.com) Subject: Re: [patch 3/4] change specific int128 -> generic intN References: <201404142303.s3EN3ONP009938@greed.delorie.com> <201406211624.s5LGOFC8031566@greed.delorie.com> X-IsSubscribed: yes Part 3 of 4, split from the full patch. Additional optimization opportunity, since the MSP430 does a lot of conversions between HImode and PSImode. gcc/ * expr.c (convert_move): If the target has an explicit converter, use it. Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 211858) +++ gcc/expr.c (working copy) @@ -405,12 +405,32 @@ convert_move (rtx to, rtx from, int unsi from) : gen_rtx_FLOAT_EXTEND (to_mode, from)); return; } /* Handle pointer conversion. */ /* SPEE 900220. */ + /* If the target has a converter from FROM_MODE to TO_MODE, use it. */ + { + convert_optab ctab; + + if (GET_MODE_PRECISION (from_mode) > GET_MODE_PRECISION (to_mode)) + ctab = trunc_optab; + else if (unsignedp) + ctab = zext_optab; + else + ctab = sext_optab; + + if (convert_optab_handler (ctab, to_mode, from_mode) + != CODE_FOR_nothing) + { + emit_unop_insn (convert_optab_handler (ctab, to_mode, from_mode), + to, from, UNKNOWN); + return; + } + } + /* Targets are expected to provide conversion insns between PxImode and xImode for all MODE_PARTIAL_INT modes they use, but no others. */ if (GET_MODE_CLASS (to_mode) == MODE_PARTIAL_INT) { enum machine_mode full_mode = smallest_mode_for_size (GET_MODE_BITSIZE (to_mode), MODE_INT);