From patchwork Fri Jul 29 15:53:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp888520pxt; Fri, 29 Jul 2022 08:54:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vNyTdVoTKIvj65+tonTZFF4dMX44e8b/CtiP8hcYuC2sPmKkXam3qyVnI4EV0fQjP6YDvl X-Received: by 2002:a17:907:2705:b0:72b:4ef4:2d91 with SMTP id w5-20020a170907270500b0072b4ef42d91mr3343661ejk.95.1659110065497; Fri, 29 Jul 2022 08:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659110065; cv=none; d=google.com; s=arc-20160816; b=uOIG8pRgopBlmUtJOlkbZxTtpvceZKwAJq7Vl/Nx7tcQo4hzhbiPiPQ2SY8IyWg2Sp lwdxaAksv+AuZzuzfs+IDEd/fniyYnGACRUMqiVbsuOWaCTfaWRrWVyjLdpGI/k2uOK3 MM6CzWxGCs1nrwX4IZhBVyjyQ5yYZVWkgJ6aq6sVMpzBc2vcS+OqNrI+L/YxdGfgirgx d2i6pc+RPC12w0ORgy77mH/09iMGvOnnE1aHaaagMK+M1OdYZsv3zh7LfjMhePq96ah0 gPdvkXzTscBxrVIfSgkUw/VAeqjtgoa5VCUuVl//zvBJ4T6TZpkLD8dA0IvTw8wncwGj 8Fzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:delivered-to; bh=aeWlOfKIw4ciPzr1eIwJ7IpsBHNKoX8+MZjkk1VqhGQ=; b=K2Ui8bJ3CzgU9+eNjDDWip7+X0M7Lxddf94W5KyXIebK6OID5Wt5zQZcX5RavhXbvu gsSD9i9Mv+elBmRudla7H4K5Bkz4wG+NTgGwcdP0wrVhXAEfW0fI0FkcG6VHTWIFxYej EaqDxEEXSWpYJCR6Cu68zrK2pSlD19pUsQwpI2UkxSqCVrUWDtw6tgm630SRBkSmkAIs Wl7KENDIgOB7ant8G8bK8JwakQkyfr8wSwDP2Z5NVIoO0JkxX/4Xl+ECuGOsSNQBQyyG Q2TMfoRRm3yZWEpuqZ21fwgNigq60ttewRdxm3koa9xhY1RHxdAPvOzTPH1n1zy1qxIw hNjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id oz11-20020a1709077d8b00b007303dda77b7si122417ejc.582.2022.07.29.08.54.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 08:54:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 065BB385AC1C for ; Fri, 29 Jul 2022 15:54:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 782583858297 for ; Fri, 29 Jul 2022 15:53:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 782583858297 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,201,1654588800"; d="scan'208";a="83209541" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 29 Jul 2022 07:53:56 -0800 IronPort-SDR: xhUzc77eSKpsz9UxFEn9u9hQBNvyBLBPwyOnaUG5rE0wTuGe+5rWRA6cx77XhYAVPY+82Kpu+7 EMmth9PsDtrcNGgS+otq6D7qogRagHM8kduvmXh+oVt5t2+Jsa6LIEtoBR4awvwadTodj2lZ11 9mDI0ptLWPsbGWs5uk5KR+Uqu4TGPD6NJefFF6AAxOC0aoJ305abgf92jRWeK3CNEPUOEbi7Xl aCT8TH876LXtYZHqSGO2EVI5KAlqRNZfXGKBW2Maxiwi7rqOoB2MMUMV4J7I0FH9XgdO3JCYGD dh0= Message-ID: <02ee1acd-1951-8cf9-345b-ca230ae432bb@codesourcery.com> Date: Fri, 29 Jul 2022 16:53:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Content-Language: en-GB To: "gcc-patches@gcc.gnu.org" From: Andrew Stubbs Subject: [PATCH] openmp-simd-clone: Match shift type X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1739702995983215065?= X-GMAIL-MSGID: =?utf-8?q?1739702995983215065?= This patch adjusts the generation of SIMD "inbranch" clones that use integer masks to ensure that it vectorizes on amdgcn. The problem was only that an amdgcn mask is DImode and the shift amount was SImode, and the difference causes vectorization to fail. OK for mainline? Andrew openmp-simd-clone: Match shift types Ensure that both parameters to vector shifts use the same mode. This is most important for amdgcn where the masks are DImode. gcc/ChangeLog: * omp-simd-clone.cc (simd_clone_adjust): Convert shift_cnt to match the mask type. diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index 32649bc3f9a..5d3a90730e7 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -1305,8 +1305,12 @@ simd_clone_adjust (struct cgraph_node *node) build_int_cst (TREE_TYPE (iter1), c)); gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); } + tree shift_cnt_conv = make_ssa_name (TREE_TYPE (mask)); + g = gimple_build_assign (shift_cnt_conv, + fold_convert (TREE_TYPE (mask), shift_cnt)); + gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); g = gimple_build_assign (make_ssa_name (TREE_TYPE (mask)), - RSHIFT_EXPR, mask, shift_cnt); + RSHIFT_EXPR, mask, shift_cnt_conv); gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); mask = gimple_assign_lhs (g); g = gimple_build_assign (make_ssa_name (TREE_TYPE (mask)),