From patchwork Mon Nov 13 03:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2" X-Patchwork-Id: 164341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp977137vqg; Sun, 12 Nov 2023 19:23:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQK3xi9kxbz3tEwnmzBQ8bcgzVZjhKyUf4MEYXPxF92xvoR7nMCPLTQ9ls7EQXsmpG3JIZ X-Received: by 2002:ac8:5c04:0:b0:40f:dfbc:2405 with SMTP id i4-20020ac85c04000000b0040fdfbc2405mr8937437qti.27.1699845791006; Sun, 12 Nov 2023 19:23:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699845790; cv=pass; d=google.com; s=arc-20160816; b=uj63tnKrQBh8vCUgPz/8/izSrema9+ljeS30XddQddGtg/Ox0a4otEwLAK61hFImFT 8ULpUkVeqf062QyjdHUDJUToUFQtI8bGp5BWfFK/211+zeHVG9+TZE6g40KhgqJ1ZA63 kKCDpMqaYqJ74PJmiLdCGE44nDwVkM2aRyUgK4TXJPzwpDDD7Y8ICLnNFotYQg11xAfj yn8bl7ET4uWhwXzpYgQlDi0ZE+Y0VL+CTN1P1aCNB6PHxLNRUTWiOXEw5NfIhCrranXX pZHyVnFIU/83GhCYwPpG7nGqRA+F5B7JKVf3GF9ZSl6aGa+lOhAxxteOFIFG/JvJToX0 WCuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=DEEKvsjXQmTmudIOV/n/RbPftQaeGM5GXShShHY6APQ=; fh=HyjTcfEWVxPCmth8NBpg90ptutEe6xkxC8SfYfQqNxQ=; b=0viF4mw4085Z7MhZv1c9PW3+K5UJrnWWir8od4gu4z8HMpxEsBaOtFN1U5agTbsNsN 9fTPM2Hg4GeySBZGD8igV2ka39iQe9oS/FRMdvEdmxzJNI6Vt6x92R7FZUBYcCtCxJFC +JkN17R9w1G8LnhmKLVP1NSGI669FNeJoG/98Rq1mW3QwqXyfqr70xVuAqAelwOeXRob kAY4pecXHrx0dH9WrJ0lPVOutMxHXqhYaGBftwZos142JuK5Zx1ib3wYo+2OBtq07c6P EfwsX8QgMF/p4ltnhnpydX7h2nxTXTALl62E+pUWua/gfSL6YDxCyPkPyBwf8favkX0F 6c/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UYGThGD9; arc=pass (i=1); 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=intel.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bs26-20020ac86f1a000000b00421c904e0e1si3052210qtb.539.2023.11.12.19.23.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Nov 2023 19:23:10 -0800 (PST) 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=@intel.com header.s=Intel header.b=UYGThGD9; arc=pass (i=1); 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=intel.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C14F73858426 for ; Mon, 13 Nov 2023 03:23:10 +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 [134.134.136.126]) by sourceware.org (Postfix) with ESMTPS id 7F8953858409 for ; Mon, 13 Nov 2023 03:22:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F8953858409 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 7F8953858409 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=134.134.136.126 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699845768; cv=none; b=BZo48EpBntp0/wi+nc5N0+SnP/jqCT02mGWpVoQSOjBYbvWTvNELihC/pmcL3HZ76dLclhmh7EJFrvndM2wSd3E4oXevOxapoM9CBrg40xfOC+EyaulQImamlpssKxaCo9OR4NfwJIZMTPUt5UiDPqvXubVx9uRp9JzR2vg9X5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699845768; c=relaxed/simple; bh=/0Z16ZuJISPOVoxZxVUup1vU2wsQF6aNMwD4pm/nmFc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=w/I63wB0kZtKfhvRo4U0yRvU6LpUcbMRK5yGeUsothTD0XIlQPc5Xxo9CMCswnNxMl7qN0Zgm2CTcg1BgP97EBEFAwGh37bBO9soi5hWfs2al41zlU7aM6EGkuhPuH5jm8gzTfzn0QSYdxHIhhB7T/n8pO/sWZaspf6iVW5yqWQ= 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=1699845765; x=1731381765; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/0Z16ZuJISPOVoxZxVUup1vU2wsQF6aNMwD4pm/nmFc=; b=UYGThGD9WPaAlSDBgYFTHo/7bZob508T1ID6Lbsxdc7I8YGcQ058G9vf DzK1TjnPZm3WVI40fc1Ri6PuQoSVE+Mtt6Uac61zm9Achp6wGX+J+cBO0 FKg3rXMRchkauHiaheyu3v8f9bhJaHk4146T76XcfBztLtMffB67Z2Apu NI7O3hgj31eSFQpgAUfz9mk2REQ9FOZlSFxO5gwXlib/MVYZkuQp4h1fr LOcMCfAoRhRXbJbTASBazRWCugJya5DvQ8DE60hX11eQNjWkb19a5tS1b noDw8PJWLO4NwkleUbZZ/0oAa67/oJTsGWN6O6F8ReImKqTs68tSyhQbZ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10892"; a="375399564" X-IronPort-AV: E=Sophos;i="6.03,298,1694761200"; d="scan'208";a="375399564" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2023 19:22:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,298,1694761200"; d="scan'208";a="5547977" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmviesa002.fm.intel.com with ESMTP; 12 Nov 2023 19:22:39 -0800 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 5006E1005703; Mon, 13 Nov 2023 11:22:38 +0800 (CST) From: pan2.li@intel.com To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, pan2.li@intel.com, yanzhang.wang@intel.com, kito.cheng@gmail.com, richard.guenther@gmail.com, richard.sandiford@arm.com2, jeffreyalaw@gmail.com Subject: [PATCH v4] DSE: Allow vector type for get_stored_val when read < store Date: Mon, 13 Nov 2023 11:22:37 +0800 Message-Id: <20231113032237.1379330-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102031423.3751965-1-pan2.li@intel.com> References: <20231102031423.3751965-1-pan2.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782065581435221573 X-GMAIL-MSGID: 1782417500023673387 From: Pan Li Update in v4: * Merge upstream and removed some independent changes. Update in v3: * Take known_le instead of known_lt for vector size. * Return NULL_RTX when gap is not equal 0 and not constant. Update in v2: * Move vector type support to get_stored_val. Original log: This patch would like to allow the vector mode in the get_stored_val in the DSE. It is valid for the read rtx if and only if the read bitsize is less than the stored bitsize. Given below example code with --param=riscv-autovec-preference=fixed-vlmax. vuint8m1_t test () { uint8_t arr[32] = { 1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9, 1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9, }; return __riscv_vle8_v_u8m1(arr, 32); } Before this patch: test: lui a5,%hi(.LANCHOR0) addi sp,sp,-32 addi a5,a5,%lo(.LANCHOR0) li a3,32 vl2re64.v v2,0(a5) vsetvli zero,a3,e8,m1,ta,ma vs2r.v v2,0(sp) <== Unnecessary store to stack vle8.v v1,0(sp) <== Ditto vs1r.v v1,0(a0) addi sp,sp,32 jr ra After this patch: test: lui a5,%hi(.LANCHOR0) addi a5,a5,%lo(.LANCHOR0) li a4,32 addi sp,sp,-32 vsetvli zero,a4,e8,m1,ta,ma vle8.v v1,0(a5) vs1r.v v1,0(a0) addi sp,sp,32 jr ra Below tests are passed within this patch: * The risc-v regression test. * The x86 bootstrap and regression test. * The aarch64 regression test. PR target/111720 gcc/ChangeLog: * dse.cc (get_stored_val): Allow vector mode if read size is less than or equal to stored size. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/pr111720-0.c: New test. * gcc.target/riscv/rvv/base/pr111720-1.c: New test. * gcc.target/riscv/rvv/base/pr111720-10.c: New test. * gcc.target/riscv/rvv/base/pr111720-2.c: New test. * gcc.target/riscv/rvv/base/pr111720-3.c: New test. * gcc.target/riscv/rvv/base/pr111720-4.c: New test. * gcc.target/riscv/rvv/base/pr111720-5.c: New test. * gcc.target/riscv/rvv/base/pr111720-6.c: New test. * gcc.target/riscv/rvv/base/pr111720-7.c: New test. * gcc.target/riscv/rvv/base/pr111720-8.c: New test. * gcc.target/riscv/rvv/base/pr111720-9.c: New test. Signed-off-by: Pan Li --- gcc/dse.cc | 9 +++++++- .../gcc.target/riscv/rvv/base/pr111720-0.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-1.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-10.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-2.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-3.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-4.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-5.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-6.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-7.c | 21 +++++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-8.c | 18 ++++++++++++++++ .../gcc.target/riscv/rvv/base/pr111720-9.c | 15 +++++++++++++ 12 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-0.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-10.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-3.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-4.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-5.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-6.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-7.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-8.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-9.c diff --git a/gcc/dse.cc b/gcc/dse.cc index 1a85dae1f8c..40c4c29d07e 100644 --- a/gcc/dse.cc +++ b/gcc/dse.cc @@ -1900,8 +1900,11 @@ get_stored_val (store_info *store_info, machine_mode read_mode, else gap = read_offset - store_info->offset; - if (gap.is_constant () && maybe_ne (gap, 0)) + if (maybe_ne (gap, 0)) { + if (!gap.is_constant ()) + return NULL_RTX; + poly_int64 shift = gap * BITS_PER_UNIT; poly_int64 access_size = GET_MODE_SIZE (read_mode) + gap; read_reg = find_shift_sequence (access_size, store_info, read_mode, @@ -1940,6 +1943,10 @@ get_stored_val (store_info *store_info, machine_mode read_mode, || GET_MODE_CLASS (read_mode) != GET_MODE_CLASS (store_mode))) read_reg = extract_low_bits (read_mode, store_mode, copy_rtx (store_info->const_rhs)); + else if (VECTOR_MODE_P (read_mode) && VECTOR_MODE_P (store_mode) + && known_le (GET_MODE_BITSIZE (read_mode), GET_MODE_BITSIZE (store_mode)) + && targetm.modes_tieable_p (read_mode, store_mode)) + read_reg = gen_lowpart (read_mode, copy_rtx (store_info->rhs)); else read_reg = extract_low_bits (read_mode, store_mode, copy_rtx (store_info->rhs)); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-0.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-0.c new file mode 100644 index 00000000000..a61e94a6d98 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-0.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8m1_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8m1(arr, 32); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-1.c new file mode 100644 index 00000000000..46efd7379ac --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8m2_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8m2(arr, 32); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[09]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-10.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-10.c new file mode 100644 index 00000000000..8bebac219a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-10.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vbool4_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vlm_v_b4(arr, 32); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-2.c new file mode 100644 index 00000000000..47e4243e02e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8m1_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8m1(arr, 16); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-3.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-3.c new file mode 100644 index 00000000000..5331e547ed3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8m2_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8m2(arr, 8); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[09]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-4.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-4.c new file mode 100644 index 00000000000..0c728f93514 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8mf2_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8mf2(arr, 32); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-5.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-5.c new file mode 100644 index 00000000000..ccfc40cd382 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-5.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8m2_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8m2(arr, 4); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[09]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-6.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-6.c new file mode 100644 index 00000000000..ce7ddbb99b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-6.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint8m8_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + return __riscv_vle8_v_u8m8(arr, 32); +} + +/* { dg-final { scan-assembler-times {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} 1 } } */ +/* { dg-final { scan-assembler-times {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-7.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-7.c new file mode 100644 index 00000000000..ac0100a1211 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-7.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vbool8_t test () { + uint8_t arr[32] = { + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + 1, 2, 7, 1, 3, 4, 5, 3, + 1, 0, 1, 2, 4, 4, 9, 9, + }; + + vuint8m1_t varr = __riscv_vle8_v_u8m1(arr, 32); + vuint8m1_t vand_m = __riscv_vand_vx_u8m1(varr, 1, 32); + + return __riscv_vreinterpret_v_u8m1_b8(vand_m); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-8.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-8.c new file mode 100644 index 00000000000..b7ebef80954 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-8.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vfloat32m1_t test () { + float arr[32] = { + 1.0, 2.2, 7.8, 1.2, 3.3, 4.7, 5.5, 3.3, + 1.0, 0.2, 1.8, 2.2, 4.3, 4.7, 9.5, 9.3, + 1.0, 2.2, 7.8, 1.2, 3.3, 4.7, 5.5, 3.3, + 1.0, 0.2, 1.8, 2.2, 4.3, 4.7, 9.5, 9.3, + }; + + return __riscv_vle32_v_f32m1(arr, 32); +} + +/* { dg-final { scan-assembler-not {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ +/* { dg-final { scan-assembler-not {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-9.c new file mode 100644 index 00000000000..21fed06d201 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr111720-9.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -Wno-psabi" } */ + +#include "riscv_vector.h" + +vfloat64m8_t test () { + double arr[8] = { + 1.0, 2.2, 7.8, 1.2, 3.3, 4.7, 5.5, 3.3, + }; + + return __riscv_vle64_v_f64m8(arr, 4); +} + +/* { dg-final { scan-assembler-times {vle[0-9]+\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} 1 } } */ +/* { dg-final { scan-assembler-times {vs[0-9]+r\.v\s+v[0-9]+,\s*[0-9]+\(sp\)} 1 } } */