From patchwork Fri Dec 9 13:38:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 704554 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 3tZtcd1stNz9vDV for ; Sat, 10 Dec 2016 00:39:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="foVZk/j4"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=oPdCFdcCPTVGpr4W5yBO9TqNtpK7S nMLXF4+h5Caj03TT5VLrXl/flWwtZMYN846lLRnskxUG8eO6XR0g84HWvONN38RD nW3VUoHQ1ZcbVs6F0AswP3eQYH310ukRAL7cVqCHhy+oxRoyvgIQu3saEkl4WE3c F07RlrIwjbKU4w= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=z36gYdEw7RuDXjYPqoMl9CM2jow=; b=foV Zk/j4ajJC5EpW6yRIWnuB0z3eWEAQZ0S4neSHeiCJG9VDAKxKhca/uJI5NmINwLw iTxJbH2m40I0mrK4wjlnC8TubjNvjqFV1pOCyXDD6mvcQk/myWZg//qixNcBTwQ9 z56CcuGn5N1mE2Xw33JtIQjSabhsU5xqgtawtTq8= Received: (qmail 13517 invoked by alias); 9 Dec 2016 13:38:43 -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 13461 invoked by uid 89); 9 Dec 2016 13:38:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 13:38:32 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ED299707; Fri, 9 Dec 2016 05:38:30 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 982493F477 for ; Fri, 9 Dec 2016 05:38:30 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [63/67] Simplifications after type switch References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:38:29 +0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <87wpf9dxyi.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 This patch makes a few simplifications after the previous mechanical machine_mode->scalar_int_mode change. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * expmed.c (extract_high_half): Use scalar_int_mode and remove assertion. (expmed_mult_highpart_optab): Likewise. (expmed_mult_highpart): Likewise. diff --git a/gcc/expmed.c b/gcc/expmed.c index 5da4c0b..2027d76 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -3602,14 +3602,11 @@ expand_mult_highpart_adjust (scalar_int_mode mode, rtx adj_operand, rtx op0, static rtx extract_high_half (scalar_int_mode mode, rtx op) { - machine_mode wider_mode; - if (mode == word_mode) return gen_highpart (mode, op); - gcc_assert (!SCALAR_FLOAT_MODE_P (mode)); + scalar_int_mode wider_mode = *GET_MODE_WIDER_MODE (mode); - wider_mode = *GET_MODE_WIDER_MODE (mode); op = expand_shift (RSHIFT_EXPR, wider_mode, op, GET_MODE_BITSIZE (mode), 0, 1); return convert_modes (mode, wider_mode, op, 0); @@ -3623,15 +3620,13 @@ expmed_mult_highpart_optab (scalar_int_mode mode, rtx op0, rtx op1, rtx target, int unsignedp, int max_cost) { rtx narrow_op1 = gen_int_mode (INTVAL (op1), mode); - machine_mode wider_mode; optab moptab; rtx tem; int size; bool speed = optimize_insn_for_speed_p (); - gcc_assert (!SCALAR_FLOAT_MODE_P (mode)); + scalar_int_mode wider_mode = *GET_MODE_WIDER_MODE (mode); - wider_mode = *GET_MODE_WIDER_MODE (mode); size = GET_MODE_BITSIZE (mode); /* Firstly, try using a multiplication insn that only generates the needed @@ -3737,7 +3732,6 @@ static rtx expmed_mult_highpart (scalar_int_mode mode, rtx op0, rtx op1, rtx target, int unsignedp, int max_cost) { - machine_mode wider_mode = *GET_MODE_WIDER_MODE (mode); unsigned HOST_WIDE_INT cnst1; int extra_cost; bool sign_adjust = false; @@ -3746,7 +3740,6 @@ expmed_mult_highpart (scalar_int_mode mode, rtx op0, rtx op1, rtx tem; bool speed = optimize_insn_for_speed_p (); - gcc_assert (!SCALAR_FLOAT_MODE_P (mode)); /* We can't support modes wider than HOST_BITS_PER_INT. */ gcc_assert (HWI_COMPUTABLE_MODE_P (mode)); @@ -3756,6 +3749,7 @@ expmed_mult_highpart (scalar_int_mode mode, rtx op0, rtx op1, ??? We might be able to perform double-word arithmetic if mode == word_mode, however all the cost calculations in synth_mult etc. assume single-word operations. */ + scalar_int_mode wider_mode = *GET_MODE_WIDER_MODE (mode); if (GET_MODE_BITSIZE (wider_mode) > BITS_PER_WORD) return expmed_mult_highpart_optab (mode, op0, op1, target, unsignedp, max_cost);