From patchwork Mon Mar 27 16:01:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Lee X-Patchwork-Id: 75540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1616862vqo; Mon, 27 Mar 2023 09:02:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YeJOFKr6dXtWZytYTIBiWceZEfmqoq9aL/zIjTgl4vEjlwfA73EQLaGnH+S5QFNnKDxBkG X-Received: by 2002:a17:907:c710:b0:8b1:806b:7dbb with SMTP id ty16-20020a170907c71000b008b1806b7dbbmr13718599ejc.51.1679932973847; Mon, 27 Mar 2023 09:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679932973; cv=none; d=google.com; s=arc-20160816; b=B/jhB1akoBwokDww4vosiLYeeJQc00lnI2JAQGdBqnHhapqCWpB98nUovcY0nuycYT 7JL3uPymDJ3eJQvTM7TaPagGLIiorXNZuQithXQkeEUw/kQZNd6cr7YMpNN1ANDHAf1e VlbaH7rDqgN7SiXq9vNoVusoAIr/vvADRfAgOtylIJNz5JCpn6zRTKwfo6h9gnv7imIL 9txQAlkormQUjtYGWzlvQ0qo7gLGTU2+eGQqCBmQZ+GfXRuYWnTMHPmXBJ8bGax5MMqC WwmcfVoIn5LNzKTb4HM9ViAbJ3HoZvu8tnuikVLm2YdYrT5ko4ev6FHUwm1CbYhVwX8y qfXQ== 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:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=DEFSVVV3l3AyqcjQ9whkfVdma40z6bxWIxX8JQA+Kxo=; b=GSOAxMkB9xj7eIt5YNKtoVr+LEF9y1xkI8qxYAFtUn4hWLU5JmbwyCo71Fbj57OaqL U4Gdb4r/IiW7aUYEbdQr73EjfsmSwu28Z/yPUdyuqV9VrY2PtEzCvbLkB3kOaBHmrrvT WC3mTX4MWOfKJwivGOAy/ZN6wzOlzSFMz4TeVEak0kTYVMPlT6H0Ytjt+2MLfZ2mT728 /g0UZBgYdz6h/ZoquJj921k7NQ4kVds5e7w3SdFFBMwjZ/X0YGvgLpx7r7SE3DaeWztE GTEc2+PEKE6j/DIWfLfzIkgyTf5SPNxZNF714YjNL8FVKCLl3TvT5xGVlsClLRo0yTNc xpXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=O+e4Le4N; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bi22-20020a170906a25600b0093dffa36a23si9082054ejb.502.2023.03.27.09.02.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 09:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=O+e4Le4N; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 1000438582AC for ; Mon, 27 Mar 2023 16:02:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by sourceware.org (Postfix) with ESMTPS id 288543858410 for ; Mon, 27 Mar 2023 16:02:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 288543858410 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pj1-x1034.google.com with SMTP id h12-20020a17090aea8c00b0023d1311fab3so9363897pjz.1 for ; Mon, 27 Mar 2023 09:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1679932931; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DEFSVVV3l3AyqcjQ9whkfVdma40z6bxWIxX8JQA+Kxo=; b=O+e4Le4NuDGekIz2b3pjVzgBSDGj1OFCmaosF+So1WoN3u7d3P/HOIOVOFooT6hp+U Jr8i1chkpwp6byqrETJSLodygl9KUQtTtWgVZn4mVQZpJPTUk2zaiJ8soR1ztPE0wXsZ Y6QgAe1BtrfzHV5SrdiN76LD8b3YTQYIVOMDsjXraIRMF8Obu+N3YZU76qU7Pg+zymUF C7tgzfwICiDJEP/EIpFZq6Nk2RqPC9iKc6Z8wRt/7z6UDQW0gXXTfpYrzf6c6PT7KVmS vJgTkyXAM1/Rh5f/k1i46oREHK9jLEQKcxKPmtFMXDYOcsIKRjGsYqSGjgtHW7VAkb0h 6urA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679932931; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DEFSVVV3l3AyqcjQ9whkfVdma40z6bxWIxX8JQA+Kxo=; b=nUqq5a+HoLrOwtpMp3gIHG4LPXC/MckmhGi9hvymtnUh1a+E5H9+aE+YArgP9274Ta sOMxUqIZNfFTbD8PNjc8eYlfeEPfMru/gRbOvzKUNw9NHJGD5PIGNhKbBqvjuS9vtuOR UuIPgt8u0cNTi7Xc/+u9XF1MTRlLabMfNcnSBLMzveD7GxWep3xD2YJuotwY6Yb6dBsQ zcAIL22f7yH0DzSx3pxFpqpqnahZ3f2jw//vZb0bzoJgDO1o/xRA9C0vJDpV/uivhuMx A4R+M4Eh/sAcldy6+cwQUZW8Wgtk0m59VkdqCOEZoXrx7HSCy/0f4Mk/zcuuSrtwba8B MrMg== X-Gm-Message-State: AAQBX9evpmurkQCIU6vYlNCvDzHYkCI7q6Hy9tUb08Vu+LYx3rn5xEZP 2qN1/GI6bnebX5Al0rgBx6TrZg1AbnEruoSfzP8= X-Received: by 2002:a17:90b:3850:b0:23b:32e5:9036 with SMTP id nl16-20020a17090b385000b0023b32e59036mr12754425pjb.17.1679932931270; Mon, 27 Mar 2023 09:02:11 -0700 (PDT) Received: from kevinl.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id y1-20020a17090a8b0100b002348d711ebbsm7705135pjn.16.2023.03.27.09.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 09:02:10 -0700 (PDT) From: Kevin Lee To: gcc-patches@gcc.gnu.org Cc: collison@rivosinc.com, Kevin Lee Subject: [PATCH v2][RFC] vect: Verify that GET_MODE_NUNITS is greater than one for vect_grouped_store_supported Date: Mon, 27 Mar 2023 09:01:57 -0700 Message-Id: <20230327160157.4111747-1-kevinl@rivosinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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?1761537397806041406?= X-GMAIL-MSGID: =?utf-8?q?1761537397806041406?= This patch is a proper fix to the previous patch https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614463.html vect_grouped_store_supported checks if the count is a power of 2, but doesn't check the size of the GET_MODE_NUNITS. This should handle the riscv case where the mode is VNx1DI since the nelt would be {1, 1}. It was tested on RISCV and x86_64-linux-gnu. Would this be correct for the vectors with size smaller than 2? --- gcc/tree-vect-data-refs.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 8daf7bd7dd3..04ad12f7d04 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -5399,6 +5399,8 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count) poly_uint64 nelt = GET_MODE_NUNITS (mode); /* The encoding has 2 interleaved stepped patterns. */ + if(!nelt.is_constant() && maybe_lt(nelt, (unsigned int) 2)) + return false; vec_perm_builder sel (nelt, 2, 3); sel.quick_grow (6); for (i = 0; i < 3; i++)