From: "Andre Vieira (lists)" <andre.simoesdiasvieira@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "jakub@redhat.com" <jakub@redhat.com>,
Richard Sandiford <richard.sandiford@arm.com>,
Richard Biener <rguenther@suse.de>
Subject: [PATCH 1/X] omp: Replace simd_clone_subparts with TYPE_VECTOR_SUBPARTS
Date: Wed, 8 Mar 2023 16:20:02 +0000 [thread overview]
Message-ID: <98e8127c-ecb0-2977-3c6c-29151edfcb15@arm.com> (raw)
In-Reply-To: <e2ca63fc-ca0b-a5c1-3b44-f82d913cf21f@arm.com>
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
Hi,
This patch replaces the uses of simd_clone_subparts with
TYPE_VECTOR_SUBPARTS and removes the definition of the first.
gcc/ChangeLog:
* omp-sind-clone.cc (simd_clone_subparts): Remove.
(simd_clone_init_simd_arrays): Replace simd_clone_subparts with
TYPE_VECTOR_SUBPARTS.
(ipa_simd_modify_function_body): Likewise.
* tree-vect-stmts.cc (simd_clone_subparts): Remove.
(vectorizable_simd_clone_call): Replace simd_clone_subparts
with TYPE_VECTOR_SUBPARTS.
[-- Attachment #2: libmvec_1.patch --]
[-- Type: text/plain, Size: 6470 bytes --]
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 0949b8ba288dfc7e7692403bfc600983faddf5dd..48b480e7556d9ad8e5502e10e513ec36b17b9cbb 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -255,16 +255,6 @@ ok_for_auto_simd_clone (struct cgraph_node *node)
return true;
}
-
-/* Return the number of elements in vector type VECTYPE, which is associated
- with a SIMD clone. At present these always have a constant length. */
-
-static unsigned HOST_WIDE_INT
-simd_clone_subparts (tree vectype)
-{
- return TYPE_VECTOR_SUBPARTS (vectype).to_constant ();
-}
-
/* Allocate a fresh `simd_clone' and return it. NARGS is the number
of arguments to reserve space for. */
@@ -1027,7 +1017,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
}
continue;
}
- if (known_eq (simd_clone_subparts (TREE_TYPE (arg)),
+ if (known_eq (TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg)),
node->simdclone->simdlen))
{
tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array)));
@@ -1039,7 +1029,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
}
else
{
- unsigned int simdlen = simd_clone_subparts (TREE_TYPE (arg));
+ poly_uint64 simdlen = TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg));
unsigned int times = vector_unroll_factor (node->simdclone->simdlen,
simdlen);
tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array)));
@@ -1225,9 +1215,9 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
iter, NULL_TREE, NULL_TREE);
adjustments->register_replacement (&(*adjustments->m_adj_params)[j], r);
- if (multiple_p (node->simdclone->simdlen, simd_clone_subparts (vectype)))
+ if (multiple_p (node->simdclone->simdlen, TYPE_VECTOR_SUBPARTS (vectype)))
j += vector_unroll_factor (node->simdclone->simdlen,
- simd_clone_subparts (vectype)) - 1;
+ TYPE_VECTOR_SUBPARTS (vectype)) - 1;
}
adjustments->sort_replacements ();
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index df6239a1c61c7213ad3c1468723bc1adf70bc02c..c85b6babc4bc5bc3111ef326dcc8f32bb25333f6 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3964,16 +3964,6 @@ vect_simd_lane_linear (tree op, class loop *loop,
}
}
-/* Return the number of elements in vector type VECTYPE, which is associated
- with a SIMD clone. At present these vectors always have a constant
- length. */
-
-static unsigned HOST_WIDE_INT
-simd_clone_subparts (tree vectype)
-{
- return TYPE_VECTOR_SUBPARTS (vectype).to_constant ();
-}
-
/* Function vectorizable_simd_clone_call.
Check if STMT_INFO performs a function call that can be vectorized
@@ -4251,7 +4241,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
slp_node);
if (arginfo[i].vectype == NULL
|| !constant_multiple_p (bestn->simdclone->simdlen,
- simd_clone_subparts (arginfo[i].vectype)))
+ TYPE_VECTOR_SUBPARTS (arginfo[i].vectype)))
return false;
}
@@ -4349,15 +4339,19 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
case SIMD_CLONE_ARG_TYPE_VECTOR:
atype = bestn->simdclone->args[i].vector_type;
o = vector_unroll_factor (nunits,
- simd_clone_subparts (atype));
+ TYPE_VECTOR_SUBPARTS (atype));
for (m = j * o; m < (j + 1) * o; m++)
{
- if (simd_clone_subparts (atype)
- < simd_clone_subparts (arginfo[i].vectype))
+ poly_uint64 atype_subparts = TYPE_VECTOR_SUBPARTS (atype);
+ poly_uint64 arginfo_subparts
+ = TYPE_VECTOR_SUBPARTS (arginfo[i].vectype);
+ if (known_lt (atype_subparts, arginfo_subparts))
{
poly_uint64 prec = GET_MODE_BITSIZE (TYPE_MODE (atype));
- k = (simd_clone_subparts (arginfo[i].vectype)
- / simd_clone_subparts (atype));
+ if (!constant_multiple_p (atype_subparts,
+ arginfo_subparts, &k))
+ gcc_unreachable ();
+
gcc_assert ((k & (k - 1)) == 0);
if (m == 0)
{
@@ -4387,8 +4381,9 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
}
else
{
- k = (simd_clone_subparts (atype)
- / simd_clone_subparts (arginfo[i].vectype));
+ if (!constant_multiple_p (arginfo_subparts,
+ atype_subparts, &k))
+ gcc_unreachable ();
gcc_assert ((k & (k - 1)) == 0);
vec<constructor_elt, va_gc> *ctor_elts;
if (k != 1)
@@ -4522,7 +4517,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
if (vec_dest)
{
gcc_assert (ratype
- || known_eq (simd_clone_subparts (rtype), nunits));
+ || known_eq (TYPE_VECTOR_SUBPARTS (rtype), nunits));
if (ratype)
new_temp = create_tmp_var (ratype);
else if (useless_type_conversion_p (vectype, rtype))
@@ -4536,13 +4531,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
if (vec_dest)
{
- if (!multiple_p (simd_clone_subparts (vectype), nunits))
+ if (!multiple_p (TYPE_VECTOR_SUBPARTS (vectype), nunits))
{
unsigned int k, l;
poly_uint64 prec = GET_MODE_BITSIZE (TYPE_MODE (vectype));
poly_uint64 bytes = GET_MODE_SIZE (TYPE_MODE (vectype));
k = vector_unroll_factor (nunits,
- simd_clone_subparts (vectype));
+ TYPE_VECTOR_SUBPARTS (vectype));
gcc_assert ((k & (k - 1)) == 0);
for (l = 0; l < k; l++)
{
@@ -4568,10 +4563,12 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
vect_clobber_variable (vinfo, stmt_info, gsi, new_temp);
continue;
}
- else if (!multiple_p (nunits, simd_clone_subparts (vectype)))
+ else if (!multiple_p (nunits, TYPE_VECTOR_SUBPARTS (vectype)))
{
- unsigned int k = (simd_clone_subparts (vectype)
- / simd_clone_subparts (rtype));
+ unsigned int k;
+ if (!constant_multiple_p (TYPE_VECTOR_SUBPARTS (vectype),
+ TYPE_VECTOR_SUBPARTS (rtype), &k))
+ gcc_unreachable ();
gcc_assert ((k & (k - 1)) == 0);
if ((j & (k - 1)) == 0)
vec_alloc (ret_ctor_elts, k);
@@ -4579,7 +4576,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
{
unsigned int m, o;
o = vector_unroll_factor (nunits,
- simd_clone_subparts (rtype));
+ TYPE_VECTOR_SUBPARTS (rtype));
for (m = 0; m < o; m++)
{
tree tem = build4 (ARRAY_REF, rtype, new_temp,
next prev parent reply other threads:[~2023-03-08 16:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 16:17 [RFC 0/X] Implement GCC support for AArch64 libmvec Andre Vieira (lists)
2023-03-08 16:20 ` Andre Vieira (lists) [this message]
2023-04-20 15:20 ` [PATCH 1/X] omp: Replace simd_clone_subparts with TYPE_VECTOR_SUBPARTS Richard Sandiford
2023-03-08 16:21 ` [PATCH 2/X] parloops: Copy target and optimizations when creating a function clone Andre Vieira (lists)
2023-03-08 16:23 ` [PATCH 3/X] parloops: Allow poly number of iterations Andre Vieira (lists)
2023-03-08 16:25 ` [RFC 4/X] omp, aarch64: Add SVE support for 'omp declare simd' [PR 96342] Andre Vieira (lists)
2023-03-08 16:26 ` [RFC 5/X] omp: Create simd clones from 'omp declare variant's Andre Vieira (lists)
2023-03-08 16:28 ` [RFC 6/X] omp: Allow creation of simd clones from omp declare variant with -fopenmp-simd flag Andre Vieira (lists)
2023-04-20 14:51 ` [RFC 0/X] Implement GCC support for AArch64 libmvec Richard Sandiford
2023-04-20 15:22 ` Andre Vieira (lists)
2023-04-20 16:02 ` Jakub Jelinek
2023-04-20 16:13 ` Richard Sandiford
2023-04-21 9:28 ` Andre Vieira (lists)
2023-04-21 9:54 ` Richard Sandiford
2023-04-21 10:28 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98e8127c-ecb0-2977-3c6c-29151edfcb15@arm.com \
--to=andre.simoesdiasvieira@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=rguenther@suse.de \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).