From patchwork Tue Oct 10 11:49:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 150692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp135130vqb; Tue, 10 Oct 2023 04:50:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJ6ieP06zMrBFQJutipnJK7pqQ7raKUUBU2NR96EZLkVSagsDHFkTLmB/R89bg7IIO1g2Q X-Received: by 2002:a17:906:328c:b0:9ae:4776:5a3a with SMTP id 12-20020a170906328c00b009ae47765a3amr16403364ejw.39.1696938628165; Tue, 10 Oct 2023 04:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696938628; cv=none; d=google.com; s=arc-20160816; b=V8HqnvFOcxEeu4wuJ4EN7T/4wf55ow7bRf4oH9aXHzHIb6ku26GmcLPvLrrcg8/nAN 3590TSnkT1X3ESxSdHJg71UJFFKmKuQCqYx7vCZEU7pJtaZ5QiCNPdX1842lcf0/URHi zpZYGHrO+2MhQbNNZ8/+f0SIbRolVP3bsPldkvNVQFgxU2EYRZHCg88/D3Cgpo9riXaM UEQsN5xyoW/4qi14YyJzoUSmtBY8htf+sWm6iWdJnurlqhGg3q4oo7c6+c7V9u67VBNy sbglvh57WpD5/+SulqbAWNqnAH2YAaApilUnGBjl0eZkPzCKeqLDmFctxKhtG1zgSXHg ERNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=k7XnKxdZlz+AHzCd645ISk/7QZaTN43cSxmP/c4mefk=; fh=idvV5TQ1gmHAoU8u1GUGfjilVySOK+BR5TeZLoSouN8=; b=ag5ziTJ2SfCw56Z0w1NMOxTdwnts0Na9/mBBhkK3WUelM3i25mQcEad3YOO4z+DVig kFNnUGRYTqyIJtFPtaLYHPwbvDO2gJPf8eE0SGSAH3LnSv+gXFKUOGJAYwnDQAW6/dJG KalngHT2BHOZDe1DnB5T/owqc5BXb1xCNFd/Er+aIp2EY+Yr9xRamGnwAuggX/OzE5n/ 1rELP3XvzSqcoqtEYBYRYiCL460vmBx18eoeRRrhrJhO+2Gaybrc3WaDmFmP5JwblEb+ 6QUIns9uP4QgEh9yMB+rhfhoUn0kTvDOyxUXV5eZ6NC2H+qAsuiH11x0kLJZHY4/7nkq oSNA== ARC-Authentication-Results: i=1; mx.google.com; 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f23-20020a170906139700b009b2d2d8f0ecsi5426772ejc.935.2023.10.10.04.50.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 04:50:28 -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; 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 31D83386193C for ; Tue, 10 Oct 2023 11:49:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by sourceware.org (Postfix) with ESMTPS id BF5FA3858D35 for ; Tue, 10 Oct 2023 11:49:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF5FA3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp76t1696938549t6qimsma Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 10 Oct 2023 19:49:08 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: viNfYEkQpuiRBgKpuBRLv9BdLyzgpF/8wafGm5PqJP3SSRVTZ2TJ6rrXT9E8o GiQUgQinvqVbIQCWPv8lVKxA8R+ripv+4Rp+MHgjDUtZ8jDuwuKyhLQXRKd5mVtOSKd0DHe z0xKw70IV0eXyQkiervHF/yv+T4/Adxz+pwpf6kEJQ81jZGoYNmpf0jqSHxJnPPnWW62J0A nqHuVGrQ1lMB6jlSK/UtoF9uUKL+do7dyyaXsmjNB2hIMH7AvF6fjY35MxoZBu60ZuTYxcY bMXtID7kw97Y5O+3ssg9121e0/1iqtgiujr1SUpNDzi00U3WFNVkGQawkGasHT/5uJngWXT pMraGI4YBXP+oaZSAHwWt9D/T+LiremZyJJMf43hNw73OpTBFYb4SeI0UDggsKxqnbiD8B+ 7TkGnq2A4E4= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 9735412795562227177 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: Juzhe-Zhong Subject: [Committed] RISC-V: Add testcase for SCCVN optimization[PR111751] Date: Tue, 10 Oct 2023 19:49:01 +0800 Message-Id: <20231010114901.4178775-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779369119297288117 X-GMAIL-MSGID: 1779369119297288117 Add testcase for PR111751 which has been fixed: https://gcc.gnu.org/pipermail/gcc-patches/2023-October/632474.html PR target/111751 gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr111751.c: New test. --- .../gcc.target/riscv/rvv/autovec/pr111751.c | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111751.c diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111751.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111751.c new file mode 100644 index 00000000000..0f1e8a7d567 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111751.c @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#define N 16 + +int foo1 () +{ + int i; + char ia[N]; + char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + /* Not vectorizable, multiplication */ + for (i = 0; i < N; i++) + { + ia[i] = ib[i] * ic[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != (char) (ib[i] * ic[i])) + __builtin_abort (); + } + + return 0; +} + +typedef int half_word; + +int foo2 () +{ + int i; + half_word ia[N]; + half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + /* Not worthwhile, only 2 parts per int */ + for (i = 0; i < N; i++) + { + ia[i] = ib[i] + ic[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (ia[i] != ib[i] + ic[i]) + __builtin_abort (); + } + + return 0; +} + +/* { dg-final { scan-assembler-times {li\s+[a-x0-9]+,0\s+ret} 2 } } */ +/* { dg-final { scan-assembler-not {vset} } } */