From patchwork Fri Mar 4 02:49:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yulong@nj.iscas.ac.cn X-Patchwork-Id: 51544 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86CCA3858C20 for ; Fri, 4 Mar 2022 02:52:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by sourceware.org (Postfix) with ESMTP id 849903857C6A for ; Fri, 4 Mar 2022 02:50:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 849903857C6A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nj.iscas.ac.cn Authentication-Results: sourceware.org; spf=none smtp.mailfrom=nj.iscas.ac.cn Received: from localhost.localdomain (unknown [47.88.16.30]) by APP-05 (Coremail) with SMTP id zQCowACn30FlfiFiZUgYAg--.62793S5; Fri, 04 Mar 2022 10:50:38 +0800 (CST) From: yulong@nj.iscas.ac.cn To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/3] RISC-V:Cache Management Operation instructions testcases Date: Fri, 4 Mar 2022 10:49:55 +0800 Message-Id: <20220304024955.25201-4-yulong@nj.iscas.ac.cn> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220304024955.25201-1-yulong@nj.iscas.ac.cn> References: <20220304024955.25201-1-yulong@nj.iscas.ac.cn> X-CM-TRANSID: zQCowACn30FlfiFiZUgYAg--.62793S5 X-Coremail-Antispam: 1UD129KBjvJXoW3Jw1rAr4UKry3GrW3CrykKrg_yoW7ur15pw s7Gw4FvrWrJF97GrWfKF1UJwsIvrs2gry5u397CryUZrs3trZFq3Z7tFW7Jr45JF1UJryf uanrua1ru3WYqw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUQ014x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UM2 8EF7xvwVC2z280aVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1U M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7M4kE6xkIj40Ew7xC0wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8 JwCFI7km07C267AKxVWUXVWUAwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14 v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY 67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI 8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v2 6r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUOOJ5UUUUU X-Originating-IP: [47.88.16.30] X-CM-SenderInfo: p1xo00fj6qyh5lvft2wodfhubq/ X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Cc: cmuellner@ventanamicro.com, ptomsich@ventanamicro.com, andrew@sifive.com, sinan@isrc.iscas.ac.cn, kito.cheng@gmail.com, jiawei@iscas.ac.cn, research_trasio@irq.a4lg.com, wuwei2016@iscas.ac.cn, yulong-plct , shihua@iscas.ac.cn Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: yulong-plct This commit adds testcases about CMO instructions. 7 8 gcc/testsuite/ChangeLog: 9 10 * gcc.target/riscv/cmo-zicbom-1.c: New test. 11 * gcc.target/riscv/cmo-zicbom-2.c: New test. 12 * gcc.target/riscv/cmo-zicbop-1.c: New test. 13 * gcc.target/riscv/cmo-zicbop-2.c: New test. 14 * gcc.target/riscv/cmo-zicboz-1.c: New test. 15 * gcc.target/riscv/cmo-zicboz-2.c: New test. --- gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c | 21 +++++++++++++++++ gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c | 21 +++++++++++++++++ gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c | 23 +++++++++++++++++++ gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c | 23 +++++++++++++++++++ gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c | 9 ++++++++ gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c | 9 ++++++++ 6 files changed, 106 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c new file mode 100644 index 00000000000..16935ff3d31 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zicbom -mabi=lp64" } */ + +int foo1() +{ + return __builtin_riscv_clean(); +} + +int foo2() +{ + return __builtin_riscv_flush(); +} + +int foo3() +{ + return __builtin_riscv_inval(); +} + +/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c new file mode 100644 index 00000000000..fc14f2b9c2b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbom-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc_zicbom -mabi=ilp32" } */ + +int foo1() +{ + return __builtin_riscv_clean(); +} + +int foo2() +{ + return __builtin_riscv_flush(); +} + +int foo3() +{ + return __builtin_riscv_inval(); +} + +/* { dg-final { scan-assembler-times "cbo.clean" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.flush" 1 } } */ +/* { dg-final { scan-assembler-times "cbo.inval" 1 } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c new file mode 100644 index 00000000000..b8bac2e8c51 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile target { { rv64-*-*}}} */ +/* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */ + +void foo (char *p) +{ + __builtin_prefetch (p, 0, 0); + __builtin_prefetch (p, 0, 1); + __builtin_prefetch (p, 0, 2); + __builtin_prefetch (p, 0, 3); + __builtin_prefetch (p, 1, 0); + __builtin_prefetch (p, 1, 1); + __builtin_prefetch (p, 1, 2); + __builtin_prefetch (p, 1, 3); +} + +int foo1() +{ + return __builtin_riscv_prefetchi(1); +} + +/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */ +/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */ +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c new file mode 100644 index 00000000000..5ace6e2b349 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c @@ -0,0 +1,23 @@ +/* { dg-do compile target { { rv32-*-*}}} */ +/* { dg-options "-march=rv32gc_zicbop -mabi=ilp32" } */ + +void foo (char *p) +{ + __builtin_prefetch (p, 0, 0); + __builtin_prefetch (p, 0, 1); + __builtin_prefetch (p, 0, 2); + __builtin_prefetch (p, 0, 3); + __builtin_prefetch (p, 1, 0); + __builtin_prefetch (p, 1, 1); + __builtin_prefetch (p, 1, 2); + __builtin_prefetch (p, 1, 3); +} + +int foo1() +{ + return __builtin_riscv_prefetchi(1); +} + +/* { dg-final { scan-assembler-times "prefetch.i" 1 } } */ +/* { dg-final { scan-assembler-times "prefetch.r" 4 } } */ +/* { dg-final { scan-assembler-times "prefetch.w" 4 } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c new file mode 100644 index 00000000000..c2401fe0cf9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zicboz -mabi=lp64" } */ + +int foo1() +{ + return __builtin_riscv_zero(); +} + +/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */ \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c new file mode 100644 index 00000000000..98fb3bf978a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicboz-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc_zicboz -mabi=ilp32" } */ + +int foo1() +{ + return __builtin_riscv_zero(); +} + +/* { dg-final { scan-assembler-times "cbo.zero" 1 } } */ \ No newline at end of file