From patchwork Thu Jul 13 08:40:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107594 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1925364qge; Thu, 13 Jul 2017 01:41:15 -0700 (PDT) X-Received: by 10.98.48.69 with SMTP id w66mr43620389pfw.214.1499935275826; Thu, 13 Jul 2017 01:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499935275; cv=none; d=google.com; s=arc-20160816; b=TvfA/JBhcaDyZ3ZXDDpPndF0moGQfXN+tzLYq6+vs3lPQFb4zvloY5h12WPZJxTD5n qh1n2Mc8+jdlL3JBZ01lrTqgvmycMuqjVnXyjvl87X1ESzTv7j3t/YH7YleFJqMrI25t 3btFiwgiWZvJJvVJs98aGJF2wsYp+7ZSXd8t7xHH6t1Q5Tf8kWzHNyW4ykOXsbMsklk7 w3nImw0O9btc7tCvNTIWMOLSkN29BG28T4zH0riKRMBF2jmm+h7WvuwXsKo9fouIxwFT cHHzWGnKguW/4z/J+9OZLUSS1oFnuvgkvoZ07T/wcJ9UouNy5PIrcuRMPBPG402t5JT/ shyQ== 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=WjXmUOBEktcNO5C24OqXRdNIsjgGXmUCdVIz9TmkPcM=; b=MQXvpOsGd+7lRF/LHDMVmeriJUmUUzsiY4+CF3DniSocNWj/1fE7JM2CGKT/QQx/ME Wk//CbAKJtxd1v+Gg2Kled2Gly+8MGmDsu6n6bJWMpH/c/geLGTRLfUs+Cn5ELuMrQlY 2cCfIMIQSHrxbjrs55wiPA3fH6EWg8G3Sqei7Xgf96nXgLw3JWjIm2V0Ktvzs6LQB/Ov smURkUpenR3LVG+y69l1B6KlJtg5/OAo1IS8UrstepjnC8Ka77DMvVDF8WxNlzGW0re7 Ur34kLOqk30AXGzvnwChWFs5QbR/DduIc31Zh8Ln4GQC9vHbjFMDDWXPgYqhaNYmIs9q 74HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=Bjsom4OW; spf=pass (google.com: domain of gcc-patches-return-457998-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-457998-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 l2si3945717pln.468.2017.07.13.01.41.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-457998-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=Bjsom4OW; spf=pass (google.com: domain of gcc-patches-return-457998-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-457998-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=VcrqlKJeD/4+zJQCmRygDqu9GBnNy Vj41UA4P7luQK7DYWCf0H/FlhB4MHivUdtEcbox+b0DZRYAtJYhzrd/KVsSM1dWi dp06dpxWIjSm9tjbS+h9HkLbef+m+9LTgPaHy6bU9Sta3TxmS2oVNfg5/RwOJMZa Ha4cxVAJ2pRig4= 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=suOV0Cih5fupNFnCXaZQGr9dRLI=; b=Bjs om4OWrHWEZG+Np4jlQJkJh24GISSW1r4KKlwzbZHGwC+NYBhfFHOhkMAaB/DmN9N WIs+N0bUFjmYnTHE+jZNaxfnw9XHMQKZ/4kHgvcVLzbbd99A0oJCOh9NY0IC9SWZ CuRbh9UQ/lEzeTqKXHz9/tSZ7stUFdp/Hi+4R0cs= Received: (qmail 34308 invoked by alias); 13 Jul 2017 08:41:01 -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 34007 invoked by uid 89); 13 Jul 2017 08:41:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 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=Hx-languages-length:3712 X-HELO: mail-wm0-f51.google.com Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:40:59 +0000 Received: by mail-wm0-f51.google.com with SMTP id w126so16366205wme.0 for ; Thu, 13 Jul 2017 01:40:59 -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=WjXmUOBEktcNO5C24OqXRdNIsjgGXmUCdVIz9TmkPcM=; b=uBDLbIuyTVMzhkM3l7QK1OHmxAOEqRvCkznCy1sW49dj+FzicvN/iErj9mjgHVWhFC TQUE9bfWWjhtjrYxD4477GhsGW36kKlSpibJ98aMfsLeS+TuIH0iMz7PFT7h6CSRPbdm VTOAGp9oTT7/a5m7RJGFzu6AzM/8O9tPJ3+9i2aDXLoVPXuIYB1SO/bpVsACeu2qB1C0 pnE0pLIEVc+w4iRligwCjRwJ5/vwvOTK0korTr7OT6MW90xVpmmcl4YX2I+CDS+o1RYV TzpAb6sVwenoOeoreVTHNXhR/wtsk4m0k5hrpQV4jv1/IryZaGr/5WsA48dZWkpVdKVq 2u4g== X-Gm-Message-State: AIVw1125VNuimgFuZExB6VwUa4NNxETn1Hm6UJQu/HomcsJirQY+AOZD hMlela09tFGXg6VKMXkgqw== X-Received: by 10.28.71.133 with SMTP id m5mr1097076wmi.97.1499935257375; Thu, 13 Jul 2017 01:40:57 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id f45sm7182105wrf.2.2017.07.13.01.40.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:40:56 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [08/77] Simplify gen_trunc/extend_conv_libfunc References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:40:55 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <877ezcn2zs.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Replace checks of: GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode) with !is_a and use MODE_CLASS equality/inequality instead of: (GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (tmode)) and: (GET_MODE_CLASS (tmode) == MODE_FLOAT && GET_MODE_CLASS (fmode) == MODE_FLOAT) || (DECIMAL_FLOAT_MODE_P (fmode) && DECIMAL_FLOAT_MODE_P (tmode)) 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * optabs-libfuncs.c (gen_trunc_conv_libfunc): Use is_a . Simplify. (gen_extend_conv_libfunc): Likewise. Index: gcc/optabs-libfuncs.c =================================================================== --- gcc/optabs-libfuncs.c 2017-07-13 09:18:22.933278054 +0100 +++ gcc/optabs-libfuncs.c 2017-07-13 09:18:24.309132693 +0100 @@ -579,24 +579,20 @@ gen_trunc_conv_libfunc (convert_optab ta machine_mode tmode, machine_mode fmode) { - if (GET_MODE_CLASS (tmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (tmode)) - return; - if (GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode)) - return; - if (tmode == fmode) + scalar_float_mode float_tmode, float_fmode; + if (!is_a (fmode, &float_fmode) + || !is_a (tmode, &float_tmode) + || float_tmode == float_fmode) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) - || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (tmode))) - gen_interclass_conv_libfunc (tab, opname, tmode, fmode); + if (GET_MODE_CLASS (float_tmode) != GET_MODE_CLASS (float_fmode)) + gen_interclass_conv_libfunc (tab, opname, float_tmode, float_fmode); - if (GET_MODE_PRECISION (fmode) <= GET_MODE_PRECISION (tmode)) + if (GET_MODE_PRECISION (float_fmode) <= GET_MODE_PRECISION (float_tmode)) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT - && GET_MODE_CLASS (fmode) == MODE_FLOAT) - || (DECIMAL_FLOAT_MODE_P (fmode) && DECIMAL_FLOAT_MODE_P (tmode))) - gen_intraclass_conv_libfunc (tab, opname, tmode, fmode); + if (GET_MODE_CLASS (float_tmode) == GET_MODE_CLASS (float_fmode)) + gen_intraclass_conv_libfunc (tab, opname, float_tmode, float_fmode); } /* Pick proper libcall for extend_optab. We need to chose if we do @@ -608,23 +604,19 @@ gen_extend_conv_libfunc (convert_optab t machine_mode tmode, machine_mode fmode) { - if (GET_MODE_CLASS (tmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (tmode)) - return; - if (GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode)) - return; - if (tmode == fmode) + scalar_float_mode float_tmode, float_fmode; + if (!is_a (fmode, &float_fmode) + || !is_a (tmode, &float_tmode) + || float_tmode == float_fmode) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) - || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (tmode))) - gen_interclass_conv_libfunc (tab, opname, tmode, fmode); + if (GET_MODE_CLASS (float_tmode) != GET_MODE_CLASS (float_fmode)) + gen_interclass_conv_libfunc (tab, opname, float_tmode, float_fmode); - if (GET_MODE_PRECISION (fmode) > GET_MODE_PRECISION (tmode)) + if (GET_MODE_PRECISION (float_fmode) > GET_MODE_PRECISION (float_tmode)) return; - if ((GET_MODE_CLASS (tmode) == MODE_FLOAT - && GET_MODE_CLASS (fmode) == MODE_FLOAT) - || (DECIMAL_FLOAT_MODE_P (fmode) && DECIMAL_FLOAT_MODE_P (tmode))) + if (GET_MODE_CLASS (float_tmode) == GET_MODE_CLASS (float_fmode)) gen_intraclass_conv_libfunc (tab, opname, tmode, fmode); }