From patchwork Fri Apr 14 02:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 83191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp81969vqo; Thu, 13 Apr 2023 19:33:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Y5l3YMBO42O1cTNqitg3SEFY9xUJkUMbB6DRfJsyjeqZy1srXiHAh+LR6wNWUJonKBPtXw X-Received: by 2002:a17:906:3143:b0:94a:5819:5a2b with SMTP id e3-20020a170906314300b0094a58195a2bmr4909544eje.33.1681439613539; Thu, 13 Apr 2023 19:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681439613; cv=none; d=google.com; s=arc-20160816; b=JCeFYqSdzLKQxdfd3blqn545oxDvg+XJ0rGqzc+ghxdv8o67yBIASFpKYaavimXW1y yqMYGGAFhGbkdH/KgtiidZf4RR3ufK+3g/v25+k4NrCR0+dpuPn7XM4h4xYOvR44CMwU QP2cc73+1kW2KhqsB3YaQJzAJIjvLajx6owi2tOMAL0FD3EZPRIeYFB+vqDQWD/jCKQp uy57I/ItrMh+mqfWdNq9hvYFAFAYtDTjP4lojTlXx4e7v9PhhAHra2/9/GS/EhrSyv+q aWVMa27I40yJMKhi9xsIID7zgSj548onKU6TVsy8/6DZ2cUmIYZVhqRI2whxvmgPoskO QShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=FxFfzIUdHZlRHpgv6l0jzLB28/UtgjmvHwVxPMh0W2I=; b=rSrPIheQqglfOaRTzjo1Rf2eY+UcmJX+x+k8r0q0pmM9h8L2TjSpmiyHxXJUf1fNz8 EgnHJwYtfnQMkKCsEaF4BavRwKDEY6steafGGJM5Z2G5zPO0YlQUE44TSDPBwMGQPgoY BRlVZQTJubz+6oVN6uzT2APwoGk6lt7Sf35IQrJrb7sDOZfYIPJNRabk/EC5y/CvOdVV ZTPKc9xkhIGO4w9qbt7+Rh8dn1K9HKUSmut8lVAF7CaXgAcK48rkBSxFz2jIuI5XGZxN TzFzfP8al3g41KH7+bH3W5gKoGrz5L8xCmK9HnH94mH8Zh3m6BzLTI5nG2TJYbFktqX9 72Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Q8yOJsmQ; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g26-20020a170906395a00b009230fbd1babsi3930483eje.892.2023.04.13.19.33.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 19:33:33 -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=@gcc.gnu.org header.s=default header.b=Q8yOJsmQ; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 18446385840C for ; Fri, 14 Apr 2023 02:33:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18446385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681439612; bh=FxFfzIUdHZlRHpgv6l0jzLB28/UtgjmvHwVxPMh0W2I=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Q8yOJsmQuGK044zCicJvjhqe/ll0t39zUcKmUWEMpeJC7H2SLGI6Kn1EqALFil03t AJ37hJxXl1XJLFibXXYN4ed8ZeDDqEIvCF+cPiOrInIwxrgRwm1zLIJHt0jR65R9eN oLk6riMyatiiEu0tzcL77ZPo9NSLnavAPpjBano8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id DE1243858D20 for ; Fri, 14 Apr 2023 02:32:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE1243858D20 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="409563251" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="409563251" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 19:32:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="722295845" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="722295845" Received: from shvmail02.sh.intel.com ([10.239.244.9]) by orsmga001.jf.intel.com with ESMTP; 13 Apr 2023 19:32:41 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.46.88]) by shvmail02.sh.intel.com (Postfix) with ESMTP id 7073C1007EBE; Fri, 14 Apr 2023 10:32:40 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, kito.cheng@sifive.com, yanzhang.wang@intel.com, pan2.li@intel.com Subject: [PATCH] RISC-V: Add test cases for the RVV mask insn shortcut. Date: Fri, 14 Apr 2023 10:32:38 +0800 Message-Id: <20230414023238.2921142-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: , X-Patchwork-Original-From: Pan Li via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: pan2.li@intel.com 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?1763117224328996346?= X-GMAIL-MSGID: =?utf-8?q?1763117224328996346?= From: Pan Li There are sorts of shortcut codegen for the RVV mask insn. For example. vmxor vd, va, va => vmclr vd. We would like to add more optimization like this but first of all we must add the tests for the existing shortcut optimization, to ensure we don't break existing optimization from underlying shortcut optimization. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/mask_insn_shortcut.c: New test. --- .../riscv/rvv/base/mask_insn_shortcut.c | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c b/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c new file mode 100644 index 00000000000..8310aabaf59 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/mask_insn_shortcut.c @@ -0,0 +1,237 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3" } */ + +#include "riscv_vector.h" + +vbool1_t test_shortcut_for_riscv_vmand_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmand_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmand_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmand_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmand_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmand_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmand_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmand_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmand_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmand_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmand_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmand_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmand_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmand_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmnand_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmnand_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmnand_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmnand_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmnand_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmnand_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmnand_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmnand_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmnand_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmnand_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmnand_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmnand_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmnand_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmnand_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmandn_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmandn_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmandn_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmandn_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmandn_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmandn_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmandn_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmandn_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmandn_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmandn_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmandn_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmandn_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmandn_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmandn_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmxor_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmxor_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmxor_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmxor_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmxor_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmxor_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmxor_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmxor_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmxor_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmxor_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmxor_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmxor_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmxor_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmxor_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmor_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmor_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmor_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmor_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmor_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmor_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmor_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmor_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmor_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmor_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmor_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmor_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmor_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmor_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmnor_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmnor_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmnor_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmnor_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmnor_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmnor_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmnor_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmnor_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmnor_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmnor_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmnor_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmnor_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmnor_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmnor_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmorn_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmorn_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmorn_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmorn_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmorn_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmorn_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmorn_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmorn_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmorn_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmorn_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmorn_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmorn_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmorn_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmorn_mm_b64(v1, v1, vl); +} + +vbool1_t test_shortcut_for_riscv_vmxnor_case_0(vbool1_t v1, size_t vl) { + return __riscv_vmxnor_mm_b1(v1, v1, vl); +} + +vbool2_t test_shortcut_for_riscv_vmxnor_case_1(vbool2_t v1, size_t vl) { + return __riscv_vmxnor_mm_b2(v1, v1, vl); +} + +vbool4_t test_shortcut_for_riscv_vmxnor_case_2(vbool4_t v1, size_t vl) { + return __riscv_vmxnor_mm_b4(v1, v1, vl); +} + +vbool8_t test_shortcut_for_riscv_vmxnor_case_3(vbool8_t v1, size_t vl) { + return __riscv_vmxnor_mm_b8(v1, v1, vl); +} + +vbool16_t test_shortcut_for_riscv_vmxnor_case_4(vbool16_t v1, size_t vl) { + return __riscv_vmxnor_mm_b16(v1, v1, vl); +} + +vbool32_t test_shortcut_for_riscv_vmxnor_case_5(vbool32_t v1, size_t vl) { + return __riscv_vmxnor_mm_b32(v1, v1, vl); +} + +vbool64_t test_shortcut_for_riscv_vmxnor_case_6(vbool64_t v1, size_t vl) { + return __riscv_vmxnor_mm_b64(v1, v1, vl); +} + +/* { dg-final { scan-assembler-not {vmand\.mm\s+v[0-9]+,\s*v[0-9]+} } } */ +/* { dg-final { scan-assembler-not {vmnand\.mm\s+v[0-9]+,\s*v[0-9]+} } } */ +/* { dg-final { scan-assembler-not {vmnandn\.mm\s+v[0-9]+,\s*v[0-9]+} } } */ +/* { dg-final { scan-assembler-not {vmxor\.mm\s+v[0-9]+,\s*v[0-9]+} } } */ +/* { dg-final { scan-assembler-not {vmor\.mm\s+v[0-9]+,\s*v[0-9]+} } } */ +/* { dg-final { scan-assembler-not {vmnor\.mm\s+v[0-9]+,\s*v[0-9]+} } } */ +/* { dg-final { scan-assembler-times {vmorn\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 7 } } */ +/* { dg-final { scan-assembler-not {vmxnor\.mm\s+v[0-9]+,\s*v[0-9]+} } } */