From patchwork Mon Jan 9 23:40:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6ZKf5bGF5ZOy?= X-Patchwork-Id: 1723761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NrVnK755hz23gB for ; Tue, 10 Jan 2023 10:40:53 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45BC938493DD for ; Mon, 9 Jan 2023 23:40:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) by sourceware.org (Postfix) with ESMTPS id 181FC3858430 for ; Mon, 9 Jan 2023 23:40:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 181FC3858430 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: bizesmtp62t1673307628taib8n2h Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 10 Jan 2023 07:40:27 +0800 (CST) X-QQ-SSF: 01400000002000E0L000B00A0000000 X-QQ-FEAT: 9FQx6vZNEAq64Rxy3R8lFawyG9U1HBV631/Ie1Z2ael76QYjPa4F0zwmvQujJ VD7QeQL7tjzCJQYEg/87O6I6TVv5Ps8xonv0Gc+1B2xgnIhYtmZgvbrpWtIWSy9u4IiX5qE ooHwCmp7B7jNJbOitnCGCtoHS5JSovsMAHw/o625PC336IvlrmolPW0WvI9wGcYHeW6X45W r9ijC/E5sfJZj/RQyAob0VKZnZMegt3MkE4mQVicKWRILLPdvotMAiqeYYggOAfYXBfu9su Q/XszCCyEgoacKxatcUDetFxgunkXw3xFlqWoLJ/qtbULH7H2oIn3PA1ewCSQvBjganbpNd UNUjH4ysl+I2pORpQISjQRNtKjh3iq2aWYlXJtjpGOgRmJTTLE5t0guelpSKyhc9EQ+TOcq X-QQ-GoodBg: 2 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, Ju-Zhe Zhong Subject: [PATCH] RISC-V: Add the rest testcases of AVL=REG support Date: Tue, 10 Jan 2023 07:40:26 +0800 Message-Id: <20230109234026.161632-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvr:qybglogicsvr7 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SCC_10_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Ju-Zhe Zhong gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/avl_single-1.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-10.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-11.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-12.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-13.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-14.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-15.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-16.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-17.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-18.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-19.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-7.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-70.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-71.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-72.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-8.c: New test. * gcc.target/riscv/rvv/vsetvl/avl_single-9.c: New test. --- .../riscv/rvv/vsetvl/avl_single-1.c | 17 ++++++ .../riscv/rvv/vsetvl/avl_single-10.c | 21 +++++++ .../riscv/rvv/vsetvl/avl_single-11.c | 21 +++++++ .../riscv/rvv/vsetvl/avl_single-12.c | 19 +++++++ .../riscv/rvv/vsetvl/avl_single-13.c | 28 ++++++++++ .../riscv/rvv/vsetvl/avl_single-14.c | 27 +++++++++ .../riscv/rvv/vsetvl/avl_single-15.c | 27 +++++++++ .../riscv/rvv/vsetvl/avl_single-16.c | 32 +++++++++++ .../riscv/rvv/vsetvl/avl_single-17.c | 29 ++++++++++ .../riscv/rvv/vsetvl/avl_single-18.c | 29 ++++++++++ .../riscv/rvv/vsetvl/avl_single-19.c | 40 +++++++++++++ .../riscv/rvv/vsetvl/avl_single-7.c | 17 ++++++ .../riscv/rvv/vsetvl/avl_single-70.c | 41 ++++++++++++++ .../riscv/rvv/vsetvl/avl_single-71.c | 54 ++++++++++++++++++ .../riscv/rvv/vsetvl/avl_single-72.c | 46 +++++++++++++++ .../riscv/rvv/vsetvl/avl_single-8.c | 18 ++++++ .../riscv/rvv/vsetvl/avl_single-9.c | 56 +++++++++++++++++++ 17 files changed, 522 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-13.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-14.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-15.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-16.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-17.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-18.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-19.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-70.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-71.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-72.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-9.c diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-1.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-1.c new file mode 100644 index 00000000000..84225dbe7d2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (void * restrict in, void * restrict out, int n, int vl) +{ + for (int i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + } +} + +/* { dg-final { scan-assembler-times {\.L[0-9]+\:\s+vle8\.v\s+v[0-9]+,\s*0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-10.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-10.c new file mode 100644 index 00000000000..f64d1c3680f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-10.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (void * restrict in, void * restrict out, int n) +{ + size_t vl = 39; + for (int i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf2_t v2 = __riscv_vle8_v_i8mf2 (in + i + 100, vl); + __riscv_vse8_v_i8mf2 (out + i + 100, v2, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-11.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-11.c new file mode 100644 index 00000000000..e1a8383e0db --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-11.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (void * restrict in, void * restrict out, int n) +{ + size_t vl = 39; + for (int i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tu (v, in + i + 100, vl); + __riscv_vse8_v_i8mf8 (out + i + 100, v2, vl); + } +} + +/* { dg-final { scan-assembler-times {\.L[0-9]+\:\s+vle8\.v\s+v[0-9]+,\s*0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-12.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-12.c new file mode 100644 index 00000000000..027bc387a5e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-12.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int cond) +{ + if (cond == 2) { + size_t vl = 101; + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + 900, vl); + __riscv_vse8_v_i8mf8 (out + 900, v, vl); + vl = 102; + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tu (v, in + 1000, vl); + __riscv_vse8_v_i8mf8 (out + 1000, v2, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-13.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-13.c new file mode 100644 index 00000000000..faf68950ad7 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-13.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int cond) +{ + size_t vl = 101; + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tu (v, in + i + 100, vl); + __riscv_vse8_v_i8mf8 (out + i + 100, v2, vl); + } + + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + 300, vl); + __riscv_vse8_v_i8mf8 (out + i + 300, v, vl); + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tu (v, in + i + 200, vl); + __riscv_vse8_v_i8mf8 (out + i + 200, v2, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-14.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-14.c new file mode 100644 index 00000000000..501d14c6e2d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-14.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int cond) +{ + size_t vl = 101; + + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tu (v, in + i + 100, vl); + __riscv_vse8_v_i8mf8 (out + i + 100, v2, vl); + } + + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + 300, vl); + __riscv_vse8_v_i8mf8 (out + i + 300, v, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-15.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-15.c new file mode 100644 index 00000000000..501e0766c22 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-15.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int cond) +{ + size_t vl = 101; + + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + 300, vl); + __riscv_vse8_v_i8mf8 (out + i + 300, v, vl); + } + + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tu (v, in + i + 100, vl); + __riscv_vse8_v_i8mf8 (out + i + 100, v2, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-16.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-16.c new file mode 100644 index 00000000000..75bed40562d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-16.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int m, int cond) +{ + size_t vl = 101; + vbool64_t mask = *(vbool64_t*) (in + 1000000); + for (size_t j = 0; j < m; j++){ + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tumu (mask, v, in + i + j + 100, vl); + __riscv_vse8_v_i8mf8_m (mask, out + i + j + 100, v2, vl); + } + + for (size_t i = 0; i < n; i++) + { + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + i + j + 200), vl); + __riscv_vse32_v_f32mf2 ((float *)(out + i + j + 200), v, vl); + + vfloat32mf2_t v2 = __riscv_vle32_v_f32mf2_tumu (mask, v, (float *)(in + i + j + 300), vl); + __riscv_vse32_v_f32mf2_m (mask, (float *)(out + i + j + 300), v2, vl); + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*mu} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-17.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-17.c new file mode 100644 index 00000000000..ad2b34095eb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-17.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int m, int cond) +{ + size_t vl = 101; + vbool64_t mask = *(vbool64_t*) (in + 1000000); + for (size_t j = 0; j < m; j++){ + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + } + + for (size_t i = 0; i < n; i++) + { + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + i + j + 200), vl); + __riscv_vse32_v_f32mf2 ((float *)(out + i + j + 200), v, vl); + + vfloat32mf2_t v2 = __riscv_vle32_v_f32mf2_tumu (mask, v, (float *)(in + i + j + 300), vl); + __riscv_vse32_v_f32mf2_m (mask, (float *)(out + i + j + 300), v2, vl); + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e32,\s*mf2,\s*tu,\s*mu} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-18.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-18.c new file mode 100644 index 00000000000..3860c6d54ff --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-18.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int m, int cond) +{ + size_t vl = 101; + vbool64_t mask = *(vbool64_t*) (in + 1000000); + for (size_t j = 0; j < m; j++){ + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8_tumu (mask, v, in + i + j + 100, vl); + __riscv_vse8_v_i8mf8_m (mask, out + i + j + 100, v2, vl); + } + + for (size_t i = 0; i < n; i++) + { + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + i + j + 200), vl); + __riscv_vse32_v_f32mf2 ((float *)(out + i + j + 200), v, vl); + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*mu} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-19.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-19.c new file mode 100644 index 00000000000..350e1d08180 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-19.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int n, int m, int cond) +{ + size_t vl = 101; + vbool64_t mask = *(vbool64_t*) (in + 1000000); + for (size_t j = 0; j < m; j++){ + for (size_t i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + } + + for (size_t i = 0; i < n * n; i++) + out[i] = out[i] * out[i]; + for (size_t i = 0; i < n * n * n; i++) + out[i] = out[i] + out[i]; + for (size_t i = 0; i < n * n * n * n; i++) + out[i] = out[i] + 2; + for (size_t i = 0; i < n * n * n * n * n; i++) + out[i] = out[i] * 100; + for (size_t i = 0; i < n * n * n * n * n * n; i++) + out[i] = out[i] - 77; + + for (size_t i = 0; i < n; i++) + { + vfloat32mf2_t v = __riscv_vle32_v_f32mf2 ((float *)(in + i + j + 200), vl); + __riscv_vse32_v_f32mf2 ((float *)(out + i + j + 200), v, vl); + + vfloat32mf2_t v2 = __riscv_vle32_v_f32mf2_tumu (mask, v, (float *)(in + i + j + 300), vl); + __riscv_vse32_v_f32mf2_m (mask, (float *)(out + i + j + 300), v2, vl); + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e32,\s*mf2,\s*tu,\s*mu} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-7.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-7.c new file mode 100644 index 00000000000..bd407b25d54 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-7.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (void * restrict in, void * restrict out, int n) +{ + register size_t vl asm ("a5"); + for (int i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*a5,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-70.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-70.c new file mode 100644 index 00000000000..89036abc9d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-70.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int l, int n, int m, size_t cond) +{ + size_t vl = 555; + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j + k, vl); + __riscv_vse8_v_i8mf8 (out + i + j + k, v, vl); + } + } + } + + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + out[i+j+k+10000000] = out[i+j+k+10000000] + in[i+j+k+10000000]; + } + } + } + + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j + k + 10000, vl); + v = __riscv_vle8_v_i8mf8_tu (v, in + i + j + k + 20000, vl); + __riscv_vse8_v_i8mf8 (out + i + j + k + 10000, v, vl); + } + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-71.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-71.c new file mode 100644 index 00000000000..0f780a7cb55 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-71.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int l, int n, int m, size_t cond) +{ + size_t vl = 555; + + if (cond) { + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j + k, vl); + __riscv_vse8_v_i8mf8 (out + i + j + k, v, vl); + } + } + } + } else { + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint32mf2_t v = __riscv_vle32_v_i32mf2 ((int32_t *)(in + i + j + k), vl); + __riscv_vse32_v_i32mf2 ((int32_t *)(out + i + j + k), v, vl); + } + } + } + } + + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + out[i+j+k+10000000] = out[i+j+k+10000000] + in[i+j+k+10000000]; + } + } + } + + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j + k + 10000, vl); + v = __riscv_vle8_v_i8mf8_tu (v, in + i + j + k + 20000, vl); + __riscv_vse8_v_i8mf8 (out + i + j + k + 10000, v, vl); + } + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-72.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-72.c new file mode 100644 index 00000000000..866370f0618 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-72.c @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (int8_t * restrict in, int8_t * restrict out, int l, int n, int m, size_t cond) +{ + size_t vl = 555; + + if (cond) { + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j + k, vl); + __riscv_vse8_v_i8mf8 (out + i + j + k, v, vl); + } + } + } + } else { + out[999] = out[999] * in[999]; + } + + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + out[i+j+k+10000000] = out[i+j+k+10000000] + in[i+j+k+10000000]; + } + } + } + + for (int i = 0; i < l; i++){ + for (int j = 0; j < m; j++){ + for (int k = 0; k < n; k++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i + j + k + 10000, vl); + v = __riscv_vle8_v_i8mf8_tu (v, in + i + j + k + 20000, vl); + __riscv_vse8_v_i8mf8 (out + i + j + k + 10000, v, vl); + } + } + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-8.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-8.c new file mode 100644 index 00000000000..0785af7f020 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-8.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (void * restrict in, void * restrict out, int n) +{ + size_t vl = 32; + for (int i = 0; i < n; i++) + { + vint8mf8_t v = __riscv_vle8_v_i8mf8 (in + i, vl); + __riscv_vse8_v_i8mf8 (out + i, v, vl); + } +} + +/* { dg-final { scan-assembler-times {\.L[0-9]+\:\s+vle8\.v\s+v[0-9]+,\s*0\s*\([a-x0-9]+\)} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-9.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-9.c new file mode 100644 index 00000000000..0ecfb969685 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-9.c @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2" } */ + +#include "riscv_vector.h" + +void f (void * restrict in, void * restrict out, int l, int n, int m) +{ + int vl = 32; + for (int i = 0; i < n; i++) + { + vint8mf8_t v1 = __riscv_vle8_v_i8mf8 (in + i + 1, vl); + __riscv_vse8_v_i8mf8 (out + i + 1, v1, vl); + + vint8mf8_t v2 = __riscv_vle8_v_i8mf8 (in + i + 2, vl); + __riscv_vse8_v_i8mf8 (out + i + 2, v2, vl); + + vint8mf8_t v3 = __riscv_vle8_v_i8mf8 (in + i + 3, vl); + __riscv_vse8_v_i8mf8 (out + i + 3, v3, vl); + + vint8mf8_t v4 = __riscv_vle8_v_i8mf8 (in + i + 4, vl); + __riscv_vse8_v_i8mf8 (out + i + 4, v4, vl); + + vint8mf8_t v5 = __riscv_vle8_v_i8mf8 (in + i + 5, vl); + __riscv_vse8_v_i8mf8 (out + i + 5, v5, vl); + + vint8mf8_t v6 = __riscv_vle8_v_i8mf8 (in + i + 6, vl); + __riscv_vse8_v_i8mf8 (out + i + 6, v6, vl); + + vint8mf8_t v7 = __riscv_vle8_v_i8mf8 (in + i + 7, vl); + __riscv_vse8_v_i8mf8 (out + i + 7, v7, vl); + + vint8mf8_t v8 = __riscv_vle8_v_i8mf8 (in + i + 8, vl); + __riscv_vse8_v_i8mf8 (out + i + 8, v8, vl); + + vint8mf8_t v9 = __riscv_vle8_v_i8mf8 (in + i + 9, vl); + __riscv_vse8_v_i8mf8 (out + i + 9, v9, vl); + + vint8mf8_t v10 = __riscv_vle8_v_i8mf8 (in + i + 10, vl); + __riscv_vse8_v_i8mf8 (out + i + 10, v10, vl); + + vint8mf8_t v11 = __riscv_vle8_v_i8mf8 (in + i + 11, vl); + __riscv_vse8_v_i8mf8 (out + i + 11, v11, vl); + + vint8mf8_t v12 = __riscv_vle8_v_i8mf8 (in + i + 12, vl); + __riscv_vse8_v_i8mf8 (out + i + 12, v12, vl); + + vint8mf8_t v13 = __riscv_vle8_v_i8mf8 (in + i + 13, vl); + __riscv_vse8_v_i8mf8 (out + i + 13, v13, vl); + + vint8mf8_t v14 = __riscv_vle8_v_i8mf8 (in + i + 14, vl); + __riscv_vse8_v_i8mf8 (out + i + 14, v14, vl); + } +} + +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 1 { target { no-opts "-O0" no-opts "-g" no-opts "-funroll-loops" } } } } */