From patchwork Thu Jul 13 08:47:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107610 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1931430qge; Thu, 13 Jul 2017 01:48:55 -0700 (PDT) X-Received: by 10.98.68.156 with SMTP id m28mr58808094pfi.159.1499935735117; Thu, 13 Jul 2017 01:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499935735; cv=none; d=google.com; s=arc-20160816; b=fJ+Ri5q36QztAwqnpzRyAKoh9pTVpuZh/P4D/3lm/GuYz9fYfYrLL8vp3HhM5bJ6zu KM+FGliWBcZ7rl/pmjyQmi7bMPuZf00cf/qrnkeGDnNNV2OT7BIRxbMi8V3AQIyLhJ72 KGe7IoF6cba1CdAR4HKYowuAwBujeen8iT6G3FoKowmfcJMEtMEVwdZChaPvsimaLuNg pbZtODbNEkC5oi8YLa78M3ldtcbjhgHRSzN7745Gz9FyXDL9zkgl+19dYh0+WOEJFxN+ gM5lXQltI++BYu4V8fseNP1oqtNwFFxZc1aYrCZ8sbjQjyHZWhvg/FMqlOoJQD1dPAJP OMNQ== 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=kvg5fogUrlyDZpyvethipKAkQwXupzsnaamHaYE9S74=; b=tohOv3g5Z8Xmotex/E7YZXVnmDMfs8gKiTpOXmTMykesQjzfilnnppx1eMGEdU78Zx jbMP+OZFLHxbJ48s62dRuUULj8RHpLD1fxUYdYz18qma69PeJzOm+vd5wKnoTXrsvCkb DBVVQtRhQofwJGXgWZLNtUP+HQvFh0gi6IXcsxNRjq34UjUeJvj5OBX9OKUB6RWOOUTA N4oDE4G3+hFsO1IzmR5JwrBYks2JRmHigSRIIX92oC60cd7UDpjmKq2BKthQ7Yp0JT/I iauVc4v/vx03Mwm2hfzdjKWf+xtHrt2nbAfyNbF5+IGilWpxou482fpdZFqY417CEeUH SCHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=V47jK320; spf=pass (google.com: domain of gcc-patches-return-458015-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458015-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 o24si4008983pli.552.2017.07.13.01.48.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458015-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=V47jK320; spf=pass (google.com: domain of gcc-patches-return-458015-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458015-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=L1PnRV9m/aqnGArWy7ZG4M0JNiBFw zOHhylCjHlyF+xCkoBki92PZhBQOUC0PE2fJeLHwzfallOAJcful8cgOdgV2zcUQ Kp7JyV4AseBPwpo1lvYQADvotYoQj//ddqhygVOchOu+dt/bM0IVBIdyUp2NW3GL U2en6g6WstXzhQ= 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=jJX2uXPO7s1Id0z3lwzERMeyOMs=; b=V47 jK320m9cT3se/d0DOEk8+lOsl2VK+N1gG9CMuK4Ieijvd9/PemtZLp88ka/qYXND EUkX/2BG5m9GN+5fz8kkES76RuDjOMLiShq+U6M5/q25i2oDJG3/eSCXiztUBrtq FFjLKed20UM4b2ORZ1qCnFAdQCkvmcHD7RBsS20M= Received: (qmail 79217 invoked by alias); 13 Jul 2017 08:47:37 -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 78855 invoked by uid 89); 13 Jul 2017 08:47:36 -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-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:47:34 +0000 Received: by mail-wm0-f51.google.com with SMTP id w126so16528380wme.0 for ; Thu, 13 Jul 2017 01:47:33 -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=kvg5fogUrlyDZpyvethipKAkQwXupzsnaamHaYE9S74=; b=Ct1J6Ympljk/mTesbOlayYeflUUYrjV4bF/QuIIPMKVtFDvJmQAdPjPE+sBJ+egMcB HSGniet7bytQZyUjz4Ax8D9AFud3ClwroZ7kCCMC5WXaoMk4dqfWCkU0rCYRe01J02p0 gdzaRk3wauYZuKXDLOj7CEnkuOV2TF1ZjUBjCC6ren1zM7ipjmSk908v2gYo0YWpIOSi moC2+uLbAedXG3jvaePM+CNS2rx1rYpX2wZoC78+c9QbubWmZBZrC5u5MHLYkyEcoJhP g+pP6B6einsnj+zGyMXOwwUDCaJwjb7qJza3D5FCccb3qojhbNysfya3weWiDZRTjVf3 ia/Q== X-Gm-Message-State: AIVw112/Qm3zqq3P4kgFBGPRawA/A7zq+d5ffbLNHJjmVDPfcnMNU2zc w/MwjYM2anrG1j05r9VQ5A== X-Received: by 10.28.139.145 with SMTP id n139mr1111774wmd.53.1499935652015; Thu, 13 Jul 2017 01:47:32 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id 13sm2813282wrl.57.2017.07.13.01.47.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:47:31 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [24/77] Replace a != BLKmode check with is_a References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:47:30 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87a848k9jx.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch replaces a check against BLKmode with a check of is_a , in a case where scalar integer modes were the only useful alternatives left. gcc/ 2017-07-13 Richard Sandiford Alan Hayward David Sherwood * gimple-fold.c (gimple_fold_builtin_memory_op): Use is_a instead of != BLKmode. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c 2017-07-08 11:37:46.572463892 +0100 +++ gcc/gimple-fold.c 2017-07-13 09:18:34.110210088 +0100 @@ -715,31 +715,29 @@ gimple_fold_builtin_memory_op (gimple_st unsigned ilen = tree_to_uhwi (len); if (pow2p_hwi (ilen)) { + scalar_int_mode mode; tree type = lang_hooks.types.type_for_size (ilen * 8, 1); if (type - && TYPE_MODE (type) != BLKmode - && (GET_MODE_SIZE (TYPE_MODE (type)) * BITS_PER_UNIT - == ilen * 8) + && is_a (TYPE_MODE (type), &mode) + && GET_MODE_SIZE (mode) * BITS_PER_UNIT == ilen * 8 /* If the destination pointer is not aligned we must be able to emit an unaligned store. */ - && (dest_align >= GET_MODE_ALIGNMENT (TYPE_MODE (type)) - || !SLOW_UNALIGNED_ACCESS (TYPE_MODE (type), dest_align) - || (optab_handler (movmisalign_optab, TYPE_MODE (type)) + && (dest_align >= GET_MODE_ALIGNMENT (mode) + || !SLOW_UNALIGNED_ACCESS (mode, dest_align) + || (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing))) { tree srctype = type; tree desttype = type; - if (src_align < GET_MODE_ALIGNMENT (TYPE_MODE (type))) + if (src_align < GET_MODE_ALIGNMENT (mode)) srctype = build_aligned_type (type, src_align); tree srcmem = fold_build2 (MEM_REF, srctype, src, off0); tree tem = fold_const_aggregate_ref (srcmem); if (tem) srcmem = tem; - else if (src_align < GET_MODE_ALIGNMENT (TYPE_MODE (type)) - && SLOW_UNALIGNED_ACCESS (TYPE_MODE (type), - src_align) - && (optab_handler (movmisalign_optab, - TYPE_MODE (type)) + else if (src_align < GET_MODE_ALIGNMENT (mode) + && SLOW_UNALIGNED_ACCESS (mode, src_align) + && (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing)) srcmem = NULL_TREE; if (srcmem) @@ -755,7 +753,7 @@ gimple_fold_builtin_memory_op (gimple_st gimple_set_vuse (new_stmt, gimple_vuse (stmt)); gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); } - if (dest_align < GET_MODE_ALIGNMENT (TYPE_MODE (type))) + if (dest_align < GET_MODE_ALIGNMENT (mode)) desttype = build_aligned_type (type, dest_align); new_stmt = gimple_build_assign (fold_build2 (MEM_REF, desttype,