From patchwork Thu Jul 13 08:49:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107615 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1932588qge; Thu, 13 Jul 2017 01:50:28 -0700 (PDT) X-Received: by 10.98.198.87 with SMTP id m84mr60664073pfg.122.1499935828088; Thu, 13 Jul 2017 01:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499935828; cv=none; d=google.com; s=arc-20160816; b=McML/zbWbX4RqU3kFyCMshDqVX3N2iu08GiAYz6clmtaWZTa6uqrQ4Bi6APoEYE8jU 6/92bRXs1KUqULgAHIhUepq/Mor6k/xWbsNWU9d3DEJf8e1ilO7NzPdAxiHmwoVCeeMH R/CbG/LgfLOxkTSevU76ietdigdQwlGtSWILD5euqs5lEPelOsDv6iLnvM/shNarVaXk aOgngLcPmTK7dxcNJBC8P181r4uc3UTP7kpW0LU6B7oNeYHKIK8lFc+qMRy/BcUpiVLx r4h+dSI1VlbLLvt6rv/QOHX48wzmsoD7viWP50/lgd/u/vxjSFOFyQvwLNn//EJ5PAIW bXmg== 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=ariXgZEf6uN/UuLg0lBk4baJjzPAu8+lHTFov4MOJPI=; b=Hu74j/M1BlMOeGqmLUTKY3qdmYUoSp2tk3/kFfSDqcYbTWeYJrVvs033m+lJZRbPFH MIE/+saAJsMnMa1AqByrjGdWSRjYR6HBQ1H5VtIAKsqGHH9UBNt2HJAFLkCsXP9NFIpX rkqGysDTsdHeFB9V0/oOd1uXSDJWU/qwdP3KYzxdCLkHyhy68whmgmaUqa5iZ8ZrR+nM SuJtV+5pf4WaFZBDUmXOztEK7I/V60hTZtmbffzMu0Q6D3DAqy7fii6nIQ98nJQQVw5m gwB90lhPvLkYC2Zy037N1gKqS3vV1Bysz/yaqpsDYKIddyAQ6m/Nca7WrJ9eRapayXA3 K1Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=ZJgBwNZi; spf=pass (google.com: domain of gcc-patches-return-458020-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458020-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 m22si3757709pfk.233.2017.07.13.01.50.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:50:28 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458020-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=ZJgBwNZi; spf=pass (google.com: domain of gcc-patches-return-458020-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458020-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=S/cmTe6pMX73LIYorumyRHfQ0xIKW lIOtswnVNFIDDqgt8YF8GwPULNL1fk6kuwJFiB/+B3EFUdiLKWJ+cc/+3kracs/e 9uTXfMWMxsDUE9mKDXo55q+NyWK08u7NcU81PIJp3ZIkv++BztpMd1fSsTODf2F7 JMtQnttU/qMti0= 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=i2dHY1R6Wem93sUXZ2s2qDssNKo=; b=ZJg BwNZiIJromfZ1XBl6AIV8xdtFiXehdN9RWl9axwJzpqy+yxvtRCv5iLHQ1EsP4y9 J0aUsJHU0RcpvB5fokv+f5T3lrwv9zwzO4AkjvpvWrO/tyxIL/LNx+S5FPO0uNJ4 N5E8sR9IBCeAxQ+UMWzZvyLNsNUbUc1py06KBK3w= Received: (qmail 27780 invoked by alias); 13 Jul 2017 08:49:18 -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 26245 invoked by uid 89); 13 Jul 2017 08:49:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f50.google.com Received: from mail-wm0-f50.google.com (HELO mail-wm0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:49:13 +0000 Received: by mail-wm0-f50.google.com with SMTP id w126so16569097wme.0 for ; Thu, 13 Jul 2017 01:49:13 -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=ariXgZEf6uN/UuLg0lBk4baJjzPAu8+lHTFov4MOJPI=; b=HryQz51t+IwvnE6YOHZAP6gQ3TtJvTtXpLDOUh0VkY8jUyxm/H52GOW3ERsvYCta/F l9GYUhXO+04+wxPdnucDTGpT7zkEiYya0ICywtOmYyhkeWzK7h6ZpYPjKDt+sNlMZ+D2 ju8oz6/YnIYQFOCjtgU/TrNF8R+vshPGOO2SQfYafvFlJwSu+0tfNps8XxEQr9bioz8N LcGPkXBhDr67NApzFjeCcaQksgfDqPVgEXKjuU7dFPmlbPgdilYerw3/WVZw9Y20lKtR UZfc+vyB1Dvdy5Pgf3gpZH4fPpyWAsrq0HSL9xaMr4Z1gd6i97bMYDUKl5xM6schfHWL u4LQ== X-Gm-Message-State: AIVw113DKCRmmAxnV+GIzz5z+S1pRErK1RTLjK/5SOvDACv6Oc86U2Ng yj7TBB9ntzoXnrA8lMr5ow== X-Received: by 10.28.10.208 with SMTP id 199mr1141298wmk.127.1499935751470; Thu, 13 Jul 2017 01:49:11 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id 2sm3289986wrn.24.2017.07.13.01.49.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:49:10 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [29/77] Make some *_loc_descriptor helpers take scalar_int_mode References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:49:09 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87o9soiuwq.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 The *_loc_descriptor routines for clz, popcount, bswap and rotate all required SCALAR_INT_MODE_P. This patch moves the checks into the caller (mem_loc_descriptor) so that the types of the mode parameters can be scalar_int_mode instead of machine_mode. The MOD handling in mem_loc_descriptor is also specific to scalar integer modes. Adding an explicit check allows typed_binop to take a scalar_int_mode too. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * dwarf2out.c (typed_binop): Change mode parameter to scalar_int_mode. (clz_loc_descriptor): Likewise. Remove SCALAR_INT_MODE_P check. (popcount_loc_descriptor): Likewise. (bswap_loc_descriptor): Likewise. (rotate_loc_descriptor): Likewise. (mem_loc_descriptor): Add is_a checks before calling the functions above. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c 2017-07-13 09:18:35.968045581 +0100 +++ gcc/dwarf2out.c 2017-07-13 09:18:36.422005956 +0100 @@ -14156,7 +14156,7 @@ minmax_loc_descriptor (rtx rtl, machine_ static dw_loc_descr_ref typed_binop (enum dwarf_location_atom op, rtx rtl, dw_die_ref type_die, - machine_mode mode, machine_mode mem_mode) + scalar_int_mode mode, machine_mode mem_mode) { dw_loc_descr_ref cvt, op0, op1; @@ -14212,7 +14212,7 @@ typed_binop (enum dwarf_location_atom op L4: DW_OP_nop */ static dw_loc_descr_ref -clz_loc_descriptor (rtx rtl, machine_mode mode, +clz_loc_descriptor (rtx rtl, scalar_int_mode mode, machine_mode mem_mode) { dw_loc_descr_ref op0, ret, tmp; @@ -14223,8 +14223,7 @@ clz_loc_descriptor (rtx rtl, machine_mod dw_loc_descr_ref l4jump, l4label; rtx msb; - if (!SCALAR_INT_MODE_P (mode) - || GET_MODE (XEXP (rtl, 0)) != mode) + if (GET_MODE (XEXP (rtl, 0)) != mode) return NULL; op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode, @@ -14324,15 +14323,14 @@ clz_loc_descriptor (rtx rtl, machine_mod L2: DW_OP_drop */ static dw_loc_descr_ref -popcount_loc_descriptor (rtx rtl, machine_mode mode, +popcount_loc_descriptor (rtx rtl, scalar_int_mode mode, machine_mode mem_mode) { dw_loc_descr_ref op0, ret, tmp; dw_loc_descr_ref l1jump, l1label; dw_loc_descr_ref l2jump, l2label; - if (!SCALAR_INT_MODE_P (mode) - || GET_MODE (XEXP (rtl, 0)) != mode) + if (GET_MODE (XEXP (rtl, 0)) != mode) return NULL; op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode, @@ -14385,17 +14383,16 @@ popcount_loc_descriptor (rtx rtl, machin L2: DW_OP_drop DW_OP_swap DW_OP_drop */ static dw_loc_descr_ref -bswap_loc_descriptor (rtx rtl, machine_mode mode, +bswap_loc_descriptor (rtx rtl, scalar_int_mode mode, machine_mode mem_mode) { dw_loc_descr_ref op0, ret, tmp; dw_loc_descr_ref l1jump, l1label; dw_loc_descr_ref l2jump, l2label; - if (!SCALAR_INT_MODE_P (mode) - || BITS_PER_UNIT != 8 + if (BITS_PER_UNIT != 8 || (GET_MODE_BITSIZE (mode) != 32 - && GET_MODE_BITSIZE (mode) != 64)) + && GET_MODE_BITSIZE (mode) != 64)) return NULL; op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode, @@ -14470,16 +14467,13 @@ bswap_loc_descriptor (rtx rtl, machine_m [ DW_OP_swap constMASK DW_OP_and DW_OP_swap ] DW_OP_shr DW_OP_or */ static dw_loc_descr_ref -rotate_loc_descriptor (rtx rtl, machine_mode mode, +rotate_loc_descriptor (rtx rtl, scalar_int_mode mode, machine_mode mem_mode) { rtx rtlop1 = XEXP (rtl, 1); dw_loc_descr_ref op0, op1, ret, mask[2] = { NULL, NULL }; int i; - if (!SCALAR_INT_MODE_P (mode)) - return NULL; - if (GET_MODE (rtlop1) != VOIDmode && GET_MODE_BITSIZE (GET_MODE (rtlop1)) < GET_MODE_BITSIZE (mode)) rtlop1 = gen_rtx_ZERO_EXTEND (mode, rtlop1); @@ -15085,12 +15079,13 @@ mem_loc_descriptor (rtx rtl, machine_mod break; case MOD: - if (GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE - && (!dwarf_strict || dwarf_version >= 5)) + if ((!dwarf_strict || dwarf_version >= 5) + && is_a (mode, &int_mode) + && GET_MODE_SIZE (int_mode) > DWARF2_ADDR_SIZE) { mem_loc_result = typed_binop (DW_OP_mod, rtl, base_type_for_mode (mode, 0), - mode, mem_mode); + int_mode, mem_mode); break; } @@ -15442,21 +15437,25 @@ mem_loc_descriptor (rtx rtl, machine_mod case CLZ: case CTZ: case FFS: - mem_loc_result = clz_loc_descriptor (rtl, mode, mem_mode); + if (is_a (mode, &int_mode)) + mem_loc_result = clz_loc_descriptor (rtl, int_mode, mem_mode); break; case POPCOUNT: case PARITY: - mem_loc_result = popcount_loc_descriptor (rtl, mode, mem_mode); + if (is_a (mode, &int_mode)) + mem_loc_result = popcount_loc_descriptor (rtl, int_mode, mem_mode); break; case BSWAP: - mem_loc_result = bswap_loc_descriptor (rtl, mode, mem_mode); + if (is_a (mode, &int_mode)) + mem_loc_result = bswap_loc_descriptor (rtl, int_mode, mem_mode); break; case ROTATE: case ROTATERT: - mem_loc_result = rotate_loc_descriptor (rtl, mode, mem_mode); + if (is_a (mode, &int_mode)) + mem_loc_result = rotate_loc_descriptor (rtl, int_mode, mem_mode); break; case COMPARE: