From patchwork Thu Jul 13 09:02:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107654 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1944921qge; Thu, 13 Jul 2017 02:04:51 -0700 (PDT) X-Received: by 10.84.128.9 with SMTP id 9mr8734725pla.61.1499936690958; Thu, 13 Jul 2017 02:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936690; cv=none; d=google.com; s=arc-20160816; b=1KHKQNvvgT9IZi1VT+q2AuPIepbAh/Tn3IOHSfLXov6IIJ+XriCkCLLYErQ7Bx4PcZ Mb7wLfUjxNR5wRyyiLULiS9VJh6b1KYuBtlLHDK012J8hWNQqf9Yp563sAOjyaURvudE Gsgo/tSagk06QAsiIGg0QT+stYtaCUikQt09HisS/xtsQbJjtULP2cnZBnpu/jbDPs3y PzpN00pD1zL0grKiv+jpVbwRYLefeP2RMyqcfQifwhHJgYOzVHs2E9mA3nxn9N2V/f39 0Q9wAfHvN4SmvnKOD13w0hEG2A2CPE9iUpNi+bHM1PeyE3q1AFBuwC+5cYmpkACL+yvp H5mQ== 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=12FOBcwaXg8E8ATtCJ58lr3Zg4axjc9FwXdhydsre4c=; b=sGD/XPx25LmA/Iy2N3pnemtfBpy53hjjoRHhPF+H6vgxT75iEmCgJbHjzOOKTbaxNP sljcXpp2OOSd+6gwJil1DQ+jeDl9BAj/kgmBwAhJHnzmbZcTonEe64AJMWR5TDZqQu2g rcln/1QV80nUJNNV8GKDuScz5H06WX9lM3KEb9XScSiP7CrCMrMQKoFSMXlhWemE7w5r 6008hq/U7Zq214FEOFWz8BS2p/A4BfUfSE7pw5f3Jqd68OgXjYh2ZCiYlMiZNUzXCCJv ZXgWk79vOd+DPP6mC0Sw5+eJUL4XckZ70moXcDthhCxXoVLMOXRCkBrQH9DWFhqKiZzu 621g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=yczqNppl; spf=pass (google.com: domain of gcc-patches-return-458059-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458059-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 g21si3781377pfk.155.2017.07.13.02.04.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 02:04:50 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458059-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=yczqNppl; spf=pass (google.com: domain of gcc-patches-return-458059-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458059-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=o4UWw77NEBJRauX09zWmR4980XVVf Terysg/hlHSVD279ouY/a01QS/iGxMR1RRGGjYhZ+Z/Z6CO1fUeTlPjOg+WY1XVV NSLT4MogluzJ5LpbBIRSx3kfhPEKBJ9kn592KMuJXcXK3OC1Ia8ue3zkLMcRaWhZ 2RpgvZ3qpVySQY= 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=efP2cIT6kNs1mVyMbXbUUegKYCY=; b=ycz qNpplJA7esH6KmVgO1WI+u9ipn1V2D//4LBDuDai1ts4is7Jj0PDM4LPuVQjGcAb 73+7Q1x0QWw9Q+e7kgOr1clfCA8jbsJcKpOBP6hcUDzQSOyimgAKhgopLOrInJnX afSxKvh4H/uaOKLNeah1KDAVzOfhOvlaOXNQjixg= Received: (qmail 129286 invoked by alias); 13 Jul 2017 09:02: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 128297 invoked by uid 89); 13 Jul 2017 09:02:48 -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= X-HELO: mail-wm0-f42.google.com Received: from mail-wm0-f42.google.com (HELO mail-wm0-f42.google.com) (74.125.82.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 09:02:44 +0000 Received: by mail-wm0-f42.google.com with SMTP id w126so16911630wme.0 for ; Thu, 13 Jul 2017 02:02:44 -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=12FOBcwaXg8E8ATtCJ58lr3Zg4axjc9FwXdhydsre4c=; b=fsQEKMJvy/bq1NiPxUtYM1HkpH5zpAZGBoTxp59PYbX3tv/GB9N55VYH80L3a4s43V oM4Ml2JQy/cYwcoIE6toGTPL36zNAv8GB2RYTGg7WVOTzkd8unZmbEg5bkYFR9bHkbGN 0/Nw3mu1TNRW+bl0IRjW8/Pipo489dqPnBLSmLiisoeYkJWWnEgAkrfecr0Q+M1VKGwt 3aZSvu68l1zBLLlGemXEBdfH020uFTeSaP0Oy4NWIqTZepBk8wA5mQ4xuWIVm3laKdw1 2HVOKYsQjEEKyaPNJfwGmvRjmMSO8PoCHejs7VCtONOPa8a9Nc6MPHF8KEy/SeiN+wQR Ldxg== X-Gm-Message-State: AIVw112tShW3C7NxOUUvUbEks+B4wT4+aHk4YIlcuP2jJs115NZGD0u0 qc4Gn9AzFrryXA1LaPXuHg== X-Received: by 10.28.8.144 with SMTP id 138mr1241944wmi.8.1499936562324; Thu, 13 Jul 2017 02:02:42 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id g63sm4705881wrd.11.2017.07.13.02.02.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 02:02:41 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [68/77] Use scalar_mode for is_int_mode/is_float_mode pairs References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 10:02:39 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87zic8btg0.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch uses scalar_mode for code that operates only on MODE_INT and MODE_FLOAT. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * omp-expand.c (expand_omp_atomic): Use is_int_mode, is_float_mode and scalar_mode. * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Likewise. Index: gcc/omp-expand.c =================================================================== --- gcc/omp-expand.c 2017-06-30 12:50:38.243662675 +0100 +++ gcc/omp-expand.c 2017-07-13 09:18:55.598479800 +0100 @@ -6724,17 +6724,18 @@ expand_omp_atomic (struct omp_region *re if (exact_log2 (align) >= index) { /* Atomic load. */ + scalar_mode smode; if (loaded_val == stored_val - && (GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT - || GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT) - && GET_MODE_BITSIZE (TYPE_MODE (type)) <= BITS_PER_WORD + && (is_int_mode (TYPE_MODE (type), &smode) + || is_float_mode (TYPE_MODE (type), &smode)) + && GET_MODE_BITSIZE (smode) <= BITS_PER_WORD && expand_omp_atomic_load (load_bb, addr, loaded_val, index)) return; /* Atomic store. */ - if ((GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT - || GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT) - && GET_MODE_BITSIZE (TYPE_MODE (type)) <= BITS_PER_WORD + if ((is_int_mode (TYPE_MODE (type), &smode) + || is_float_mode (TYPE_MODE (type), &smode)) + && GET_MODE_BITSIZE (smode) <= BITS_PER_WORD && store_bb == single_succ (load_bb) && first_stmt (store_bb) == store && expand_omp_atomic_store (load_bb, addr, loaded_val, Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2017-07-13 09:18:54.003596374 +0100 +++ gcc/tree-vect-stmts.c 2017-07-13 09:18:55.599479728 +0100 @@ -8936,18 +8936,16 @@ free_stmt_vec_info (gimple *stmt) get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size) { tree orig_scalar_type = scalar_type; - machine_mode inner_mode = TYPE_MODE (scalar_type); + scalar_mode inner_mode; machine_mode simd_mode; - unsigned int nbytes = GET_MODE_SIZE (inner_mode); int nunits; tree vectype; - if (nbytes == 0) + if (!is_int_mode (TYPE_MODE (scalar_type), &inner_mode) + && !is_float_mode (TYPE_MODE (scalar_type), &inner_mode)) return NULL_TREE; - if (GET_MODE_CLASS (inner_mode) != MODE_INT - && GET_MODE_CLASS (inner_mode) != MODE_FLOAT) - return NULL_TREE; + unsigned int nbytes = GET_MODE_SIZE (inner_mode); /* For vector types of elements whose mode precision doesn't match their types precision we use a element type of mode