From patchwork Mon Apr 22 08:27:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2" X-Patchwork-Id: 88838 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 D607C3844747 for ; Mon, 22 Apr 2024 08:29:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by sourceware.org (Postfix) with ESMTPS id EB9CD3849AC9 for ; Mon, 22 Apr 2024 08:27:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB9CD3849AC9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EB9CD3849AC9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713774442; cv=none; b=RLnDDRfdTU33rltzWE9qyQH9Ly2irgyQiQZkKk9QhISNKpxNER+2IshWFtIAuLAD7rHEuy8a2WvMyFwDvDEkmTKKjoylBA0qd4871n7m092i5ComxlK8dl68svAjlTSy1V1XLSkjw1gTP5gyEspuLNRIWHPXsZS9qORc9DMIyu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713774442; c=relaxed/simple; bh=O/JI523Y+FDftbGdIOvwKbXoIA8v8fPjQgt6YHuUAYU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Fal3/iXk0DuT3oSiwKaN7Z7ov4cQxq0qNvVbci/eIPIBkJWxJWnA0teXz4iAAUEvP2zOw0dn9HywDu5/yhGHV907Ajqq4HfO40I3F+OqAPdsDzaOzzRIqxMX73Em1ZL5VgjttiUvKFN0+KpHuIlx+Ptw5vLouCRd7JKsOJS7spY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713774436; x=1745310436; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=O/JI523Y+FDftbGdIOvwKbXoIA8v8fPjQgt6YHuUAYU=; b=CgBnTnfjmH7YaZR6C846x1LqhEKKYaSdZYBTpItmPkj3qKd3KGICWXjy zzhDM75iWc9HHpkW3/M79adwmj4y5ASrvM1gm6jgsSXey+QpIuVl2gZgu CZY5pnpFmsrk2dj39d9e2elW854NeWxmRoFDP3/f461p7nwQDvVb+gxpl NnvkMB3DwQ3du6di0XwLJS8/lUaZhn5oC86aQVgtAk32k1FpyZ3h9dz1y BUU50DpavVZjhwm8SxDnAqUCE+obUyeTCEPNYbf5TdvMqjKIdc55G3Q3l 6Q95Kf6n1wu05m9EHAaEfw/EquLm6M0qdLLsycekq78qYrvEl/dgXQNVX Q==; X-CSE-ConnectionGUID: +pdyNe7kRXCqjOQNS0pHWw== X-CSE-MsgGUID: oX5Q8dTHRC+ICzgJrrGrqg== X-IronPort-AV: E=McAfee;i="6600,9927,11051"; a="9129228" X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="9129228" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2024 01:27:15 -0700 X-CSE-ConnectionGUID: zaVRkNdJQmiI0U/yta9gXA== X-CSE-MsgGUID: 4FptjG4hSmSMUkKW5gTPKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="23993697" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmviesa006.fm.intel.com with ESMTP; 22 Apr 2024 01:27:10 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 5EF4D100737E; Mon, 22 Apr 2024 16:27:09 +0800 (CST) From: pan2.li@intel.com To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, kito.cheng@gmail.com, rdapp.gcc@gmail.com, Pan Li Subject: [PATCH v1] RISC-V: Add xfail test case for highpart overlap floating-point widen insn Date: Mon, 22 Apr 2024 16:27:07 +0800 Message-Id: <20240422082707.1592898-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org From: Pan Li We reverted below patch for register group overlap, add the related insn test and mark it as xfail. And we will remove the xfail after we support the register overlap in GCC-15. 8614cbb2534 RISC-V: Support highpart overlap for floating-point widen instructions The below test suites are passed. * The rv64gcv fully regression test. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/pr112431-10.c: New test. * gcc.target/riscv/rvv/base/pr112431-11.c: New test. * gcc.target/riscv/rvv/base/pr112431-12.c: New test. * gcc.target/riscv/rvv/base/pr112431-13.c: New test. * gcc.target/riscv/rvv/base/pr112431-14.c: New test. * gcc.target/riscv/rvv/base/pr112431-15.c: New test. * gcc.target/riscv/rvv/base/pr112431-7.c: New test. * gcc.target/riscv/rvv/base/pr112431-8.c: New test. * gcc.target/riscv/rvv/base/pr112431-9.c: New test. Signed-off-by: Pan Li Signed-off-by: Pan Li --- .../gcc.target/riscv/rvv/base/pr112431-10.c | 104 ++++++++++ .../gcc.target/riscv/rvv/base/pr112431-11.c | 68 +++++++ .../gcc.target/riscv/rvv/base/pr112431-12.c | 51 +++++ .../gcc.target/riscv/rvv/base/pr112431-13.c | 188 ++++++++++++++++++ .../gcc.target/riscv/rvv/base/pr112431-14.c | 119 +++++++++++ .../gcc.target/riscv/rvv/base/pr112431-15.c | 86 ++++++++ .../gcc.target/riscv/rvv/base/pr112431-7.c | 104 ++++++++++ .../gcc.target/riscv/rvv/base/pr112431-8.c | 68 +++++++ .../gcc.target/riscv/rvv/base/pr112431-9.c | 51 +++++ 9 files changed, 839 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-11.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-12.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-13.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-14.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-15.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-9.c diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-10.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-10.c new file mode 100644 index 00000000000..5d3f2fbe46d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-10.c @@ -0,0 +1,104 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3, double sum4, + double sum5, double sum6, double sum7, double sum8, double sum9, + double sum10, double sum11, double sum12, double sum13, double sum14, + double sum15) +{ + return sum0 + sum1 + sum2 + sum3 + sum4 + sum5 + sum6 + sum7 + sum8 + sum9 + + sum10 + sum11 + sum12 + sum13 + sum14 + sum15; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vint32m1_t v0 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v1 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v2 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v3 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v4 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v5 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v6 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v7 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v8 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v9 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v10 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v11 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v12 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v13 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v14 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + vint32m1_t v15 = __riscv_vle32_v_i32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vfloat64m2_t vw0 = __riscv_vfwcvt_f_x_v_f64m2 (v0, vl); + vfloat64m2_t vw1 = __riscv_vfwcvt_f_x_v_f64m2 (v1, vl); + vfloat64m2_t vw2 = __riscv_vfwcvt_f_x_v_f64m2 (v2, vl); + vfloat64m2_t vw3 = __riscv_vfwcvt_f_x_v_f64m2 (v3, vl); + vfloat64m2_t vw4 = __riscv_vfwcvt_f_x_v_f64m2 (v4, vl); + vfloat64m2_t vw5 = __riscv_vfwcvt_f_x_v_f64m2 (v5, vl); + vfloat64m2_t vw6 = __riscv_vfwcvt_f_x_v_f64m2 (v6, vl); + vfloat64m2_t vw7 = __riscv_vfwcvt_f_x_v_f64m2 (v7, vl); + vfloat64m2_t vw8 = __riscv_vfwcvt_f_x_v_f64m2 (v8, vl); + vfloat64m2_t vw9 = __riscv_vfwcvt_f_x_v_f64m2 (v9, vl); + vfloat64m2_t vw10 = __riscv_vfwcvt_f_x_v_f64m2 (v10, vl); + vfloat64m2_t vw11 = __riscv_vfwcvt_f_x_v_f64m2 (v11, vl); + vfloat64m2_t vw12 = __riscv_vfwcvt_f_x_v_f64m2 (v12, vl); + vfloat64m2_t vw13 = __riscv_vfwcvt_f_x_v_f64m2 (v13, vl); + vfloat64m2_t vw14 = __riscv_vfwcvt_f_x_v_f64m2 (v14, vl); + vfloat64m2_t vw15 = __riscv_vfwcvt_f_x_v_f64m2 (v15, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vfmv_f_s_f64m2_f64 (vw0); + double sum1 = __riscv_vfmv_f_s_f64m2_f64 (vw1); + double sum2 = __riscv_vfmv_f_s_f64m2_f64 (vw2); + double sum3 = __riscv_vfmv_f_s_f64m2_f64 (vw3); + double sum4 = __riscv_vfmv_f_s_f64m2_f64 (vw4); + double sum5 = __riscv_vfmv_f_s_f64m2_f64 (vw5); + double sum6 = __riscv_vfmv_f_s_f64m2_f64 (vw6); + double sum7 = __riscv_vfmv_f_s_f64m2_f64 (vw7); + double sum8 = __riscv_vfmv_f_s_f64m2_f64 (vw8); + double sum9 = __riscv_vfmv_f_s_f64m2_f64 (vw9); + double sum10 = __riscv_vfmv_f_s_f64m2_f64 (vw10); + double sum11 = __riscv_vfmv_f_s_f64m2_f64 (vw11); + double sum12 = __riscv_vfmv_f_s_f64m2_f64 (vw12); + double sum13 = __riscv_vfmv_f_s_f64m2_f64 (vw13); + double sum14 = __riscv_vfmv_f_s_f64m2_f64 (vw14); + double sum15 = __riscv_vfmv_f_s_f64m2_f64 (vw15); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum8, + sum9, sum10, sum11, sum12, sum13, sum14, sum15); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-11.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-11.c new file mode 100644 index 00000000000..6a2301b523f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-11.c @@ -0,0 +1,68 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3, double sum4, + double sum5, double sum6, double sum7) +{ + return sum0 + sum1 + sum2 + sum3 + sum4 + sum5 + sum6 + sum7; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vint32m2_t v0 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v1 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v2 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v3 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v4 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v5 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v6 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + vint32m2_t v7 = __riscv_vle32_v_i32m2 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vfloat64m4_t vw0 = __riscv_vfwcvt_f_x_v_f64m4 (v0, vl); + vfloat64m4_t vw1 = __riscv_vfwcvt_f_x_v_f64m4 (v1, vl); + vfloat64m4_t vw2 = __riscv_vfwcvt_f_x_v_f64m4 (v2, vl); + vfloat64m4_t vw3 = __riscv_vfwcvt_f_x_v_f64m4 (v3, vl); + vfloat64m4_t vw4 = __riscv_vfwcvt_f_x_v_f64m4 (v4, vl); + vfloat64m4_t vw5 = __riscv_vfwcvt_f_x_v_f64m4 (v5, vl); + vfloat64m4_t vw6 = __riscv_vfwcvt_f_x_v_f64m4 (v6, vl); + vfloat64m4_t vw7 = __riscv_vfwcvt_f_x_v_f64m4 (v7, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vfmv_f_s_f64m4_f64 (vw0); + double sum1 = __riscv_vfmv_f_s_f64m4_f64 (vw1); + double sum2 = __riscv_vfmv_f_s_f64m4_f64 (vw2); + double sum3 = __riscv_vfmv_f_s_f64m4_f64 (vw3); + double sum4 = __riscv_vfmv_f_s_f64m4_f64 (vw4); + double sum5 = __riscv_vfmv_f_s_f64m4_f64 (vw5); + double sum6 = __riscv_vfmv_f_s_f64m4_f64 (vw6); + double sum7 = __riscv_vfmv_f_s_f64m4_f64 (vw7); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-12.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-12.c new file mode 100644 index 00000000000..0f3eb4d58de --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-12.c @@ -0,0 +1,51 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3) +{ + return sum0 + sum1 + sum2 + sum3; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vint32m4_t v0 = __riscv_vle32_v_i32m4 ((void *) it, vl); + it += vl; + vint32m4_t v1 = __riscv_vle32_v_i32m4 ((void *) it, vl); + it += vl; + vint32m4_t v2 = __riscv_vle32_v_i32m4 ((void *) it, vl); + it += vl; + vint32m4_t v3 = __riscv_vle32_v_i32m4 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vfloat64m8_t vw0 = __riscv_vfwcvt_f_x_v_f64m8 (v0, vl); + vfloat64m8_t vw1 = __riscv_vfwcvt_f_x_v_f64m8 (v1, vl); + vfloat64m8_t vw2 = __riscv_vfwcvt_f_x_v_f64m8 (v2, vl); + vfloat64m8_t vw3 = __riscv_vfwcvt_f_x_v_f64m8 (v3, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vfmv_f_s_f64m8_f64 (vw0); + double sum1 = __riscv_vfmv_f_s_f64m8_f64 (vw1); + double sum2 = __riscv_vfmv_f_s_f64m8_f64 (vw2); + double sum3 = __riscv_vfmv_f_s_f64m8_f64 (vw3); + + sum += sumation (sum0, sum1, sum2, sum3); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-13.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-13.c new file mode 100644 index 00000000000..71786995c56 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-13.c @@ -0,0 +1,188 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3, double sum4, + double sum5, double sum6, double sum7, double sum8, double sum9, + double sum10, double sum11, double sum12, double sum13, double sum14, + double sum15) +{ + return sum0 + sum1 + sum2 + sum3 + sum4 + sum5 + sum6 + sum7 + sum8 + sum9 + + sum10 + sum11 + sum12 + sum13 + sum14 + sum15; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v4 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v5 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v6 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v7 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v8 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v9 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v10 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v11 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v12 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v13 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v14 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v15 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vint64m2_t vw0 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v0, vl); + vint64m2_t vw1 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v1, vl); + vint64m2_t vw2 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v2, vl); + vint64m2_t vw3 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v3, vl); + vint64m2_t vw4 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v4, vl); + vint64m2_t vw5 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v5, vl); + vint64m2_t vw6 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v6, vl); + vint64m2_t vw7 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v7, vl); + vint64m2_t vw8 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v8, vl); + vint64m2_t vw9 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v9, vl); + vint64m2_t vw10 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v10, vl); + vint64m2_t vw11 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v11, vl); + vint64m2_t vw12 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v12, vl); + vint64m2_t vw13 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v13, vl); + vint64m2_t vw14 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v14, vl); + vint64m2_t vw15 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v15, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vmv_x_s_i64m2_i64 (vw0); + double sum1 = __riscv_vmv_x_s_i64m2_i64 (vw1); + double sum2 = __riscv_vmv_x_s_i64m2_i64 (vw2); + double sum3 = __riscv_vmv_x_s_i64m2_i64 (vw3); + double sum4 = __riscv_vmv_x_s_i64m2_i64 (vw4); + double sum5 = __riscv_vmv_x_s_i64m2_i64 (vw5); + double sum6 = __riscv_vmv_x_s_i64m2_i64 (vw6); + double sum7 = __riscv_vmv_x_s_i64m2_i64 (vw7); + double sum8 = __riscv_vmv_x_s_i64m2_i64 (vw8); + double sum9 = __riscv_vmv_x_s_i64m2_i64 (vw9); + double sum10 = __riscv_vmv_x_s_i64m2_i64 (vw10); + double sum11 = __riscv_vmv_x_s_i64m2_i64 (vw11); + double sum12 = __riscv_vmv_x_s_i64m2_i64 (vw12); + double sum13 = __riscv_vmv_x_s_i64m2_i64 (vw13); + double sum14 = __riscv_vmv_x_s_i64m2_i64 (vw14); + double sum15 = __riscv_vmv_x_s_i64m2_i64 (vw15); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum8, + sum9, sum10, sum11, sum12, sum13, sum14, sum15); + } + return sum; +} + +double +foo2 (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v4 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v5 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v6 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v7 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v8 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v9 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v10 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v11 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v12 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v13 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v14 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v15 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vint64m2_t vw0 = __riscv_vfwcvt_x_f_v_i64m2 (v0, vl); + vint64m2_t vw1 = __riscv_vfwcvt_x_f_v_i64m2 (v1, vl); + vint64m2_t vw2 = __riscv_vfwcvt_x_f_v_i64m2 (v2, vl); + vint64m2_t vw3 = __riscv_vfwcvt_x_f_v_i64m2 (v3, vl); + vint64m2_t vw4 = __riscv_vfwcvt_x_f_v_i64m2 (v4, vl); + vint64m2_t vw5 = __riscv_vfwcvt_x_f_v_i64m2 (v5, vl); + vint64m2_t vw6 = __riscv_vfwcvt_x_f_v_i64m2 (v6, vl); + vint64m2_t vw7 = __riscv_vfwcvt_x_f_v_i64m2 (v7, vl); + vint64m2_t vw8 = __riscv_vfwcvt_x_f_v_i64m2 (v8, vl); + vint64m2_t vw9 = __riscv_vfwcvt_x_f_v_i64m2 (v9, vl); + vint64m2_t vw10 = __riscv_vfwcvt_x_f_v_i64m2 (v10, vl); + vint64m2_t vw11 = __riscv_vfwcvt_x_f_v_i64m2 (v11, vl); + vint64m2_t vw12 = __riscv_vfwcvt_x_f_v_i64m2 (v12, vl); + vint64m2_t vw13 = __riscv_vfwcvt_x_f_v_i64m2 (v13, vl); + vint64m2_t vw14 = __riscv_vfwcvt_x_f_v_i64m2 (v14, vl); + vint64m2_t vw15 = __riscv_vfwcvt_x_f_v_i64m2 (v15, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vmv_x_s_i64m2_i64 (vw0); + double sum1 = __riscv_vmv_x_s_i64m2_i64 (vw1); + double sum2 = __riscv_vmv_x_s_i64m2_i64 (vw2); + double sum3 = __riscv_vmv_x_s_i64m2_i64 (vw3); + double sum4 = __riscv_vmv_x_s_i64m2_i64 (vw4); + double sum5 = __riscv_vmv_x_s_i64m2_i64 (vw5); + double sum6 = __riscv_vmv_x_s_i64m2_i64 (vw6); + double sum7 = __riscv_vmv_x_s_i64m2_i64 (vw7); + double sum8 = __riscv_vmv_x_s_i64m2_i64 (vw8); + double sum9 = __riscv_vmv_x_s_i64m2_i64 (vw9); + double sum10 = __riscv_vmv_x_s_i64m2_i64 (vw10); + double sum11 = __riscv_vmv_x_s_i64m2_i64 (vw11); + double sum12 = __riscv_vmv_x_s_i64m2_i64 (vw12); + double sum13 = __riscv_vmv_x_s_i64m2_i64 (vw13); + double sum14 = __riscv_vmv_x_s_i64m2_i64 (vw14); + double sum15 = __riscv_vmv_x_s_i64m2_i64 (vw15); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum8, + sum9, sum10, sum11, sum12, sum13, sum14, sum15); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-14.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-14.c new file mode 100644 index 00000000000..535ea7ce34b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-14.c @@ -0,0 +1,119 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3, double sum4, + double sum5, double sum6, double sum7) +{ + return sum0 + sum1 + sum2 + sum3 + sum4 + sum5 + sum6 + sum7; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v4 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v5 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v6 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v7 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vint64m2_t vw0 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v0, vl); + vint64m2_t vw1 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v1, vl); + vint64m2_t vw2 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v2, vl); + vint64m2_t vw3 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v3, vl); + vint64m2_t vw4 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v4, vl); + vint64m2_t vw5 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v5, vl); + vint64m2_t vw6 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v6, vl); + vint64m2_t vw7 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v7, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vmv_x_s_i64m2_i64 (vw0); + double sum1 = __riscv_vmv_x_s_i64m2_i64 (vw1); + double sum2 = __riscv_vmv_x_s_i64m2_i64 (vw2); + double sum3 = __riscv_vmv_x_s_i64m2_i64 (vw3); + double sum4 = __riscv_vmv_x_s_i64m2_i64 (vw4); + double sum5 = __riscv_vmv_x_s_i64m2_i64 (vw5); + double sum6 = __riscv_vmv_x_s_i64m2_i64 (vw6); + double sum7 = __riscv_vmv_x_s_i64m2_i64 (vw7); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7); + } + return sum; +} + +double +foo2 (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v4 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v5 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v6 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v7 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vint64m2_t vw0 = __riscv_vfwcvt_x_f_v_i64m2 (v0, vl); + vint64m2_t vw1 = __riscv_vfwcvt_x_f_v_i64m2 (v1, vl); + vint64m2_t vw2 = __riscv_vfwcvt_x_f_v_i64m2 (v2, vl); + vint64m2_t vw3 = __riscv_vfwcvt_x_f_v_i64m2 (v3, vl); + vint64m2_t vw4 = __riscv_vfwcvt_x_f_v_i64m2 (v4, vl); + vint64m2_t vw5 = __riscv_vfwcvt_x_f_v_i64m2 (v5, vl); + vint64m2_t vw6 = __riscv_vfwcvt_x_f_v_i64m2 (v6, vl); + vint64m2_t vw7 = __riscv_vfwcvt_x_f_v_i64m2 (v7, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vmv_x_s_i64m2_i64 (vw0); + double sum1 = __riscv_vmv_x_s_i64m2_i64 (vw1); + double sum2 = __riscv_vmv_x_s_i64m2_i64 (vw2); + double sum3 = __riscv_vmv_x_s_i64m2_i64 (vw3); + double sum4 = __riscv_vmv_x_s_i64m2_i64 (vw4); + double sum5 = __riscv_vmv_x_s_i64m2_i64 (vw5); + double sum6 = __riscv_vmv_x_s_i64m2_i64 (vw6); + double sum7 = __riscv_vmv_x_s_i64m2_i64 (vw7); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-15.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-15.c new file mode 100644 index 00000000000..3d46e4a829a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-15.c @@ -0,0 +1,86 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3) +{ + return sum0 + sum1 + sum2 + sum3; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vint64m2_t vw0 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v0, vl); + vint64m2_t vw1 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v1, vl); + vint64m2_t vw2 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v2, vl); + vint64m2_t vw3 = __riscv_vfwcvt_rtz_x_f_v_i64m2 (v3, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vmv_x_s_i64m2_i64 (vw0); + double sum1 = __riscv_vmv_x_s_i64m2_i64 (vw1); + double sum2 = __riscv_vmv_x_s_i64m2_i64 (vw2); + double sum3 = __riscv_vmv_x_s_i64m2_i64 (vw3); + + sum += sumation (sum0, sum1, sum2, sum3); + } + return sum; +} + +double +foo2 (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vint64m2_t vw0 = __riscv_vfwcvt_x_f_v_i64m2 (v0, vl); + vint64m2_t vw1 = __riscv_vfwcvt_x_f_v_i64m2 (v1, vl); + vint64m2_t vw2 = __riscv_vfwcvt_x_f_v_i64m2 (v2, vl); + vint64m2_t vw3 = __riscv_vfwcvt_x_f_v_i64m2 (v3, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vmv_x_s_i64m2_i64 (vw0); + double sum1 = __riscv_vmv_x_s_i64m2_i64 (vw1); + double sum2 = __riscv_vmv_x_s_i64m2_i64 (vw2); + double sum3 = __riscv_vmv_x_s_i64m2_i64 (vw3); + + sum += sumation (sum0, sum1, sum2, sum3); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-7.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-7.c new file mode 100644 index 00000000000..59cbd7ff4be --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-7.c @@ -0,0 +1,104 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3, double sum4, + double sum5, double sum6, double sum7, double sum8, double sum9, + double sum10, double sum11, double sum12, double sum13, double sum14, + double sum15) +{ + return sum0 + sum1 + sum2 + sum3 + sum4 + sum5 + sum6 + sum7 + sum8 + sum9 + + sum10 + sum11 + sum12 + sum13 + sum14 + sum15; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m1_t v0 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v1 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v2 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v3 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v4 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v5 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v6 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v7 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v8 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v9 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v10 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v11 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v12 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v13 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v14 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + vfloat32m1_t v15 = __riscv_vle32_v_f32m1 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vfloat64m2_t vw0 = __riscv_vfwcvt_f_f_v_f64m2 (v0, vl); + vfloat64m2_t vw1 = __riscv_vfwcvt_f_f_v_f64m2 (v1, vl); + vfloat64m2_t vw2 = __riscv_vfwcvt_f_f_v_f64m2 (v2, vl); + vfloat64m2_t vw3 = __riscv_vfwcvt_f_f_v_f64m2 (v3, vl); + vfloat64m2_t vw4 = __riscv_vfwcvt_f_f_v_f64m2 (v4, vl); + vfloat64m2_t vw5 = __riscv_vfwcvt_f_f_v_f64m2 (v5, vl); + vfloat64m2_t vw6 = __riscv_vfwcvt_f_f_v_f64m2 (v6, vl); + vfloat64m2_t vw7 = __riscv_vfwcvt_f_f_v_f64m2 (v7, vl); + vfloat64m2_t vw8 = __riscv_vfwcvt_f_f_v_f64m2 (v8, vl); + vfloat64m2_t vw9 = __riscv_vfwcvt_f_f_v_f64m2 (v9, vl); + vfloat64m2_t vw10 = __riscv_vfwcvt_f_f_v_f64m2 (v10, vl); + vfloat64m2_t vw11 = __riscv_vfwcvt_f_f_v_f64m2 (v11, vl); + vfloat64m2_t vw12 = __riscv_vfwcvt_f_f_v_f64m2 (v12, vl); + vfloat64m2_t vw13 = __riscv_vfwcvt_f_f_v_f64m2 (v13, vl); + vfloat64m2_t vw14 = __riscv_vfwcvt_f_f_v_f64m2 (v14, vl); + vfloat64m2_t vw15 = __riscv_vfwcvt_f_f_v_f64m2 (v15, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vfmv_f_s_f64m2_f64 (vw0); + double sum1 = __riscv_vfmv_f_s_f64m2_f64 (vw1); + double sum2 = __riscv_vfmv_f_s_f64m2_f64 (vw2); + double sum3 = __riscv_vfmv_f_s_f64m2_f64 (vw3); + double sum4 = __riscv_vfmv_f_s_f64m2_f64 (vw4); + double sum5 = __riscv_vfmv_f_s_f64m2_f64 (vw5); + double sum6 = __riscv_vfmv_f_s_f64m2_f64 (vw6); + double sum7 = __riscv_vfmv_f_s_f64m2_f64 (vw7); + double sum8 = __riscv_vfmv_f_s_f64m2_f64 (vw8); + double sum9 = __riscv_vfmv_f_s_f64m2_f64 (vw9); + double sum10 = __riscv_vfmv_f_s_f64m2_f64 (vw10); + double sum11 = __riscv_vfmv_f_s_f64m2_f64 (vw11); + double sum12 = __riscv_vfmv_f_s_f64m2_f64 (vw12); + double sum13 = __riscv_vfmv_f_s_f64m2_f64 (vw13); + double sum14 = __riscv_vfmv_f_s_f64m2_f64 (vw14); + double sum15 = __riscv_vfmv_f_s_f64m2_f64 (vw15); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum8, + sum9, sum10, sum11, sum12, sum13, sum14, sum15); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-8.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-8.c new file mode 100644 index 00000000000..3a8ca02bd21 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-8.c @@ -0,0 +1,68 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3, double sum4, + double sum5, double sum6, double sum7) +{ + return sum0 + sum1 + sum2 + sum3 + sum4 + sum5 + sum6 + sum7; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m2_t v0 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v1 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v2 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v3 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v4 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v5 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v6 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + vfloat32m2_t v7 = __riscv_vle32_v_f32m2 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vfloat64m4_t vw0 = __riscv_vfwcvt_f_f_v_f64m4 (v0, vl); + vfloat64m4_t vw1 = __riscv_vfwcvt_f_f_v_f64m4 (v1, vl); + vfloat64m4_t vw2 = __riscv_vfwcvt_f_f_v_f64m4 (v2, vl); + vfloat64m4_t vw3 = __riscv_vfwcvt_f_f_v_f64m4 (v3, vl); + vfloat64m4_t vw4 = __riscv_vfwcvt_f_f_v_f64m4 (v4, vl); + vfloat64m4_t vw5 = __riscv_vfwcvt_f_f_v_f64m4 (v5, vl); + vfloat64m4_t vw6 = __riscv_vfwcvt_f_f_v_f64m4 (v6, vl); + vfloat64m4_t vw7 = __riscv_vfwcvt_f_f_v_f64m4 (v7, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vfmv_f_s_f64m4_f64 (vw0); + double sum1 = __riscv_vfmv_f_s_f64m4_f64 (vw1); + double sum2 = __riscv_vfmv_f_s_f64m4_f64 (vw2); + double sum3 = __riscv_vfmv_f_s_f64m4_f64 (vw3); + double sum4 = __riscv_vfmv_f_s_f64m4_f64 (vw4); + double sum5 = __riscv_vfmv_f_s_f64m4_f64 (vw5); + double sum6 = __riscv_vfmv_f_s_f64m4_f64 (vw6); + double sum7 = __riscv_vfmv_f_s_f64m4_f64 (vw7); + + sum += sumation (sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-9.c new file mode 100644 index 00000000000..88ab1d9da5c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-9.c @@ -0,0 +1,51 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +double __attribute__ ((noinline)) +sumation (double sum0, double sum1, double sum2, double sum3) +{ + return sum0 + sum1 + sum2 + sum3; +} + +double +foo (char const *buf, size_t len) +{ + double sum = 0; + size_t vl = __riscv_vsetvlmax_e8m8 (); + size_t step = vl * 4; + const char *it = buf, *end = buf + len; + for (; it + step <= end;) + { + vfloat32m4_t v0 = __riscv_vle32_v_f32m4 ((void *) it, vl); + it += vl; + vfloat32m4_t v1 = __riscv_vle32_v_f32m4 ((void *) it, vl); + it += vl; + vfloat32m4_t v2 = __riscv_vle32_v_f32m4 ((void *) it, vl); + it += vl; + vfloat32m4_t v3 = __riscv_vle32_v_f32m4 ((void *) it, vl); + it += vl; + + asm volatile("nop" ::: "memory"); + vfloat64m8_t vw0 = __riscv_vfwcvt_f_f_v_f64m8 (v0, vl); + vfloat64m8_t vw1 = __riscv_vfwcvt_f_f_v_f64m8 (v1, vl); + vfloat64m8_t vw2 = __riscv_vfwcvt_f_f_v_f64m8 (v2, vl); + vfloat64m8_t vw3 = __riscv_vfwcvt_f_f_v_f64m8 (v3, vl); + + asm volatile("nop" ::: "memory"); + double sum0 = __riscv_vfmv_f_s_f64m8_f64 (vw0); + double sum1 = __riscv_vfmv_f_s_f64m8_f64 (vw1); + double sum2 = __riscv_vfmv_f_s_f64m8_f64 (vw2); + double sum3 = __riscv_vfmv_f_s_f64m8_f64 (vw3); + + sum += sumation (sum0, sum1, sum2, sum3); + } + return sum; +} + +/* { dg-final { scan-assembler-not {vmv1r} } } */ +/* { dg-final { scan-assembler-not {vmv2r} } } */ +/* { dg-final { scan-assembler-not {vmv4r} } } */ +/* { dg-final { scan-assembler-not {vmv8r} } } */ +/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */