From patchwork Thu Jul 13 08:48:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107613 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1932006qge; Thu, 13 Jul 2017 01:49:39 -0700 (PDT) X-Received: by 10.99.135.73 with SMTP id i70mr7937548pge.74.1499935779705; Thu, 13 Jul 2017 01:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499935779; cv=none; d=google.com; s=arc-20160816; b=RC/nvWxNJVxRPGnqPqWUsOMkpC9yxDzUxaXcyZfXOtiUeXNVHklh56vLRqoMQD/nzV KN9mqG00BqsdqzxYPMPt+ngtOAaHz3yyn45NSYTANT0vkRNUvYO+B7CZHHC+yUEYwUJI B9LGq3HyTYxHH1pudrI5Y2HPlBfVVjfHB4CD4+plPJL0LSthC22hzcxHnlbLhLvmxNNc aBFatWJbkC8LmUKIF96lVKA4yJddb2fg8hx9bJdT2VvglfREKFK/Q9XH6SC4n/7aiS4G ym/lBl5OEvoH+p162wXF/wZBPPuKlb0d7jqswslpba5QbJp+8CMuJwfhZxwbR9mGDywV FOfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=k0Nkabq1tuaO6Jx8Lz7wMXjER/I0vqLUsJh7phyHdzY=; b=D4fs1FUbwxo1EyoChzS1MlMIExq/QxYNBwL+XPoG415UPc0EWQ/E3AMqCaEzfgSrhy PQS2vnIN71EMuqfcK7kePjeDspjH5jypLWYrvr2155T5beFnnp5ZU46dT+nm+c3Y/JEm XPC4c9WKY8eNbQXZkpoXdc8Ub8zCtwcRNl60LVYJ70GgPH8KUbHKl5+bWuJZOh7OC+aI b5GW4ZrybQ9v6kKS0fHPHyr/f/3LwWKhMR2KgivSCS/NbKa85GXnkdlx+x+QJtsO0oSw 1IzDSaYZ7vXUEiPU3x7Gy0T7mhBWIENVVCAye+YEttfiJfmDgmY8HzG/6UJ5x7PjzFjP Q3Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=RRVmwlCg; spf=pass (google.com: domain of gcc-patches-return-458018-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458018-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s71si3754033pfk.12.2017.07.13.01.49.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458018-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=RRVmwlCg; spf=pass (google.com: domain of gcc-patches-return-458018-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458018-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=yp9Eh2YGb0wn/34kCWqkch2f2Yq8c 1+zEqsgS4XIHYvh/jli3g3umcnmCK3bcpEvnyUzHK3YKX1DWKz19vl7IArghrRJ+ K+KJvKWMi/NLH78UWA1M5y3pj9djSFC83WBaK2YpStj11PwpzSL+4j47vt46Dh8N gkyrAgi7mAGYAk= 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=SggvoMm5sKMsNvHWUgr6JTD5+q0=; b=RRV mwlCgGgZSX8KiiEKaakhErP89z8WyuEhLyUqx9dJadlcNhCfbpapGH89SwIs8MaE upmgaASdQX662PrrKrKfTuQdeZkVBc5xtPzhAo3cak4tgXofARLi+sO/OBXlZDvw rt22j8b35hdDtgTB+8stiVKV1v/IWASMPFFg7L6Q= Received: (qmail 7454 invoked by alias); 13 Jul 2017 08:48:48 -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 122246 invoked by uid 89); 13 Jul 2017 08:48:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3806 X-HELO: mail-wr0-f180.google.com Received: from mail-wr0-f180.google.com (HELO mail-wr0-f180.google.com) (209.85.128.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:48:36 +0000 Received: by mail-wr0-f180.google.com with SMTP id r103so49509618wrb.0 for ; Thu, 13 Jul 2017 01:48:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=k0Nkabq1tuaO6Jx8Lz7wMXjER/I0vqLUsJh7phyHdzY=; b=scAgKwCStFoHMxiHpoAxRnJIIusLmQtNAlA2JnHx3O0HOTX+p3qCKDXPuNDbnNF7BB LU6Yp1/vAGVY/IF3CByr+xeuRtZDTtxPFvY/f1mrbr+8HMzlwa11WAPNbDqXfspB6kZq b16gfW2PCqxoVX+InjQWQZzHt74dec8VwGqpjoQz0Bde61bSkXPXnUrkrYydrUG8iprY HJ26GbBH4XTtU8SHqnn4HwRcH10Ie0X/X1ZmQCVkOyTT69h8mPtZeC/+ajZM3cC9Ncoe 3jKorcgfatg723DUaLgzmIfKGta2RtODaE92UHrc7pNIykTCKIg+dY3T5CBKASdGTF0X 3slQ== X-Gm-Message-State: AIVw113scUd4ggp4CY4fxL2Sn39cHopTAWe8H5i5S0S3QfoGKJIXcroK 8MTqE6C5JhJSXOpCwdZ4wQ== X-Received: by 10.223.139.24 with SMTP id n24mr936641wra.116.1499935711428; Thu, 13 Jul 2017 01:48:31 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id e125sm4956727wmd.25.2017.07.13.01.48.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:48:30 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [27/77] Use is_a before LOAD_EXTEND_OP References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:48:29 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87wp7ciuxu.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch adds is_a checks before load_extend_op/ LOAD_EXTEND_OP calls, if that becomes useful for later patches. (load_extend_op will return UNKNOWN for any other type of mode.) 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * cse.c (cse_insn): Add is_a checks. * reload.c (push_reload): Likewise. (find_reloads): Likewise. Index: gcc/cse.c =================================================================== --- gcc/cse.c 2017-07-13 09:18:31.692428965 +0100 +++ gcc/cse.c 2017-07-13 09:18:35.510085933 +0100 @@ -4923,7 +4923,8 @@ cse_insn (rtx_insn *insn) rtx_code extend_op; if (flag_expensive_optimizations && src_related == 0 && MEM_P (src) && ! do_not_record - && (extend_op = load_extend_op (mode)) != UNKNOWN) + && is_a (mode, &int_mode) + && (extend_op = load_extend_op (int_mode)) != UNKNOWN) { struct rtx_def memory_extend_buf; rtx memory_extend_rtx = &memory_extend_buf; @@ -4935,7 +4936,7 @@ cse_insn (rtx_insn *insn) PUT_CODE (memory_extend_rtx, extend_op); XEXP (memory_extend_rtx, 0) = src; - FOR_EACH_WIDER_MODE (tmode, mode) + FOR_EACH_WIDER_MODE (tmode, int_mode) { struct table_elt *larger_elt; @@ -4952,7 +4953,7 @@ cse_insn (rtx_insn *insn) larger_elt; larger_elt = larger_elt->next_same_value) if (REG_P (larger_elt->exp)) { - src_related = gen_lowpart (mode, larger_elt->exp); + src_related = gen_lowpart (int_mode, larger_elt->exp); break; } Index: gcc/reload.c =================================================================== --- gcc/reload.c 2017-07-13 09:18:32.527352795 +0100 +++ gcc/reload.c 2017-07-13 09:18:35.511085845 +0100 @@ -1050,6 +1050,7 @@ push_reload (rtx in, rtx out, rtx *inloc register class. But if it is inside a STRICT_LOW_PART, we have no choice, so we hope we do get the right register class there. */ + scalar_int_mode inner_mode; if (in != 0 && GET_CODE (in) == SUBREG && (subreg_lowpart_p (in) || strict_low) #ifdef CANNOT_CHANGE_MODE_CLASS @@ -1065,12 +1066,12 @@ push_reload (rtx in, rtx out, rtx *inloc && ((GET_MODE_PRECISION (inmode) > GET_MODE_PRECISION (GET_MODE (SUBREG_REG (in)))) || (GET_MODE_SIZE (inmode) <= UNITS_PER_WORD - && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))) - <= UNITS_PER_WORD) + && is_a (GET_MODE (SUBREG_REG (in)), + &inner_mode) + && GET_MODE_SIZE (inner_mode) <= UNITS_PER_WORD && (GET_MODE_PRECISION (inmode) - > GET_MODE_PRECISION (GET_MODE (SUBREG_REG (in)))) - && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (in))) - && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (in))) != UNKNOWN) + > GET_MODE_PRECISION (inner_mode)) + && LOAD_EXTEND_OP (inner_mode) != UNKNOWN) || (WORD_REGISTER_OPERATIONS && (GET_MODE_PRECISION (inmode) < GET_MODE_PRECISION (GET_MODE (SUBREG_REG (in)))) @@ -3109,6 +3110,7 @@ find_reloads (rtx_insn *insn, int replac operand = SUBREG_REG (operand); /* Force reload if this is a constant or PLUS or if there may be a problem accessing OPERAND in the outer mode. */ + scalar_int_mode inner_mode; if (CONSTANT_P (operand) || GET_CODE (operand) == PLUS /* We must force a reload of paradoxical SUBREGs @@ -3146,13 +3148,13 @@ find_reloads (rtx_insn *insn, int replac || BYTES_BIG_ENDIAN || ((GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD) - && (GET_MODE_SIZE (GET_MODE (operand)) + && (is_a + (GET_MODE (operand), &inner_mode)) + && (GET_MODE_SIZE (inner_mode) <= UNITS_PER_WORD) && (GET_MODE_SIZE (operand_mode[i]) - > GET_MODE_SIZE (GET_MODE (operand))) - && INTEGRAL_MODE_P (GET_MODE (operand)) - && LOAD_EXTEND_OP (GET_MODE (operand)) - != UNKNOWN))) + > GET_MODE_SIZE (inner_mode)) + && LOAD_EXTEND_OP (inner_mode) != UNKNOWN))) ) force_reload = 1; }