* [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
@ 2024-07-29 7:57 pan2.li
2024-07-29 8:44 ` Richard Biener
2024-07-29 16:08 ` Richard Sandiford
0 siblings, 2 replies; 5+ messages in thread
From: pan2.li @ 2024-07-29 7:57 UTC (permalink / raw)
To: gcc-patches
Cc: juzhe.zhong, kito.cheng, richard.guenther, tamar.christina,
jeffreyalaw, rdapp.gcc, Pan Li
From: Pan Li <pan2.li@intel.com>
For some target like target=amdgcn-amdhsa, we need to take care of
vector bool types prior to general vector mode types. Or we may have
the asm check failure as below.
gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
gcc.target/gcn/cond_smin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
gcc.target/gcn/cond_umax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
gcc.target/gcn/cond_umin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
gcc.dg/tree-ssa/loop-bound-2.c scan-tree-dump-not ivopts "zero if "
The below test suites are passed for this patch.
1. The rv64gcv fully regression tests.
2. The x86 bootstrap tests.
3. The x86 fully regression tests.
4. The amdgcn test case as above.
gcc/ChangeLog:
* internal-fn.cc (type_strictly_matches_mode_p): Add handling
for vector bool type.
Signed-off-by: Pan Li <pan2.li@intel.com>
---
gcc/internal-fn.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
index 8a2e07f2f96..086c8be398a 100644
--- a/gcc/internal-fn.cc
+++ b/gcc/internal-fn.cc
@@ -4171,6 +4171,12 @@ direct_internal_fn_optab (internal_fn fn)
static bool
type_strictly_matches_mode_p (const_tree type)
{
+ /* For target=amdgcn-amdhsa, we need to take care of vector bool types.
+ More details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116103. */
+ if (VECTOR_BOOLEAN_TYPE_P (type) && SCALAR_INT_MODE_P (TYPE_MODE (type))
+ && TYPE_PRECISION (TREE_TYPE (type)) == 1)
+ return true;
+
if (VECTOR_TYPE_P (type))
return VECTOR_MODE_P (TYPE_MODE (type));
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
2024-07-29 7:57 [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103] pan2.li
@ 2024-07-29 8:44 ` Richard Biener
2024-07-29 12:24 ` Li, Pan2
2024-07-29 16:08 ` Richard Sandiford
1 sibling, 1 reply; 5+ messages in thread
From: Richard Biener @ 2024-07-29 8:44 UTC (permalink / raw)
To: pan2.li
Cc: gcc-patches, juzhe.zhong, kito.cheng, tamar.christina,
jeffreyalaw, rdapp.gcc
On Mon, Jul 29, 2024 at 9:57 AM <pan2.li@intel.com> wrote:
>
> From: Pan Li <pan2.li@intel.com>
>
> For some target like target=amdgcn-amdhsa, we need to take care of
> vector bool types prior to general vector mode types. Or we may have
> the asm check failure as below.
>
> gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_smin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_umax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.target/gcn/cond_umin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.dg/tree-ssa/loop-bound-2.c scan-tree-dump-not ivopts "zero if "
>
> The below test suites are passed for this patch.
> 1. The rv64gcv fully regression tests.
> 2. The x86 bootstrap tests.
> 3. The x86 fully regression tests.
> 4. The amdgcn test case as above.
OK.
Richard.
> gcc/ChangeLog:
>
> * internal-fn.cc (type_strictly_matches_mode_p): Add handling
> for vector bool type.
>
> Signed-off-by: Pan Li <pan2.li@intel.com>
> ---
> gcc/internal-fn.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
> index 8a2e07f2f96..086c8be398a 100644
> --- a/gcc/internal-fn.cc
> +++ b/gcc/internal-fn.cc
> @@ -4171,6 +4171,12 @@ direct_internal_fn_optab (internal_fn fn)
> static bool
> type_strictly_matches_mode_p (const_tree type)
> {
> + /* For target=amdgcn-amdhsa, we need to take care of vector bool types.
> + More details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116103. */
> + if (VECTOR_BOOLEAN_TYPE_P (type) && SCALAR_INT_MODE_P (TYPE_MODE (type))
> + && TYPE_PRECISION (TREE_TYPE (type)) == 1)
> + return true;
> +
> if (VECTOR_TYPE_P (type))
> return VECTOR_MODE_P (TYPE_MODE (type));
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
2024-07-29 8:44 ` Richard Biener
@ 2024-07-29 12:24 ` Li, Pan2
0 siblings, 0 replies; 5+ messages in thread
From: Li, Pan2 @ 2024-07-29 12:24 UTC (permalink / raw)
To: Richard Biener
Cc: gcc-patches, juzhe.zhong, kito.cheng, tamar.christina,
jeffreyalaw, rdapp.gcc
> OK.
Thanks Richard, will wait the confirmation from Thomas in case I missed some more failed cases.
Pan
-----Original Message-----
From: Richard Biener <richard.guenther@gmail.com>
Sent: Monday, July 29, 2024 4:44 PM
To: Li, Pan2 <pan2.li@intel.com>
Cc: gcc-patches@gcc.gnu.org; juzhe.zhong@rivai.ai; kito.cheng@gmail.com; tamar.christina@arm.com; jeffreyalaw@gmail.com; rdapp.gcc@gmail.com
Subject: Re: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
On Mon, Jul 29, 2024 at 9:57 AM <pan2.li@intel.com> wrote:
>
> From: Pan Li <pan2.li@intel.com>
>
> For some target like target=amdgcn-amdhsa, we need to take care of
> vector bool types prior to general vector mode types. Or we may have
> the asm check failure as below.
>
> gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_smin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_umax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.target/gcn/cond_umin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.dg/tree-ssa/loop-bound-2.c scan-tree-dump-not ivopts "zero if "
>
> The below test suites are passed for this patch.
> 1. The rv64gcv fully regression tests.
> 2. The x86 bootstrap tests.
> 3. The x86 fully regression tests.
> 4. The amdgcn test case as above.
OK.
Richard.
> gcc/ChangeLog:
>
> * internal-fn.cc (type_strictly_matches_mode_p): Add handling
> for vector bool type.
>
> Signed-off-by: Pan Li <pan2.li@intel.com>
> ---
> gcc/internal-fn.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
> index 8a2e07f2f96..086c8be398a 100644
> --- a/gcc/internal-fn.cc
> +++ b/gcc/internal-fn.cc
> @@ -4171,6 +4171,12 @@ direct_internal_fn_optab (internal_fn fn)
> static bool
> type_strictly_matches_mode_p (const_tree type)
> {
> + /* For target=amdgcn-amdhsa, we need to take care of vector bool types.
> + More details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116103. */
> + if (VECTOR_BOOLEAN_TYPE_P (type) && SCALAR_INT_MODE_P (TYPE_MODE (type))
> + && TYPE_PRECISION (TREE_TYPE (type)) == 1)
> + return true;
> +
> if (VECTOR_TYPE_P (type))
> return VECTOR_MODE_P (TYPE_MODE (type));
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
2024-07-29 7:57 [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103] pan2.li
2024-07-29 8:44 ` Richard Biener
@ 2024-07-29 16:08 ` Richard Sandiford
2024-07-30 3:10 ` Li, Pan2
1 sibling, 1 reply; 5+ messages in thread
From: Richard Sandiford @ 2024-07-29 16:08 UTC (permalink / raw)
To: pan2.li
Cc: gcc-patches, juzhe.zhong, kito.cheng, richard.guenther,
tamar.christina, jeffreyalaw, rdapp.gcc
pan2.li@intel.com writes:
> From: Pan Li <pan2.li@intel.com>
>
> For some target like target=amdgcn-amdhsa, we need to take care of
> vector bool types prior to general vector mode types. Or we may have
> the asm check failure as below.
>
> gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_smin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_umax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.target/gcn/cond_umin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.dg/tree-ssa/loop-bound-2.c scan-tree-dump-not ivopts "zero if "
>
> The below test suites are passed for this patch.
> 1. The rv64gcv fully regression tests.
> 2. The x86 bootstrap tests.
> 3. The x86 fully regression tests.
> 4. The amdgcn test case as above.
>
> gcc/ChangeLog:
>
> * internal-fn.cc (type_strictly_matches_mode_p): Add handling
> for vector bool type.
>
> Signed-off-by: Pan Li <pan2.li@intel.com>
> ---
> gcc/internal-fn.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
> index 8a2e07f2f96..086c8be398a 100644
> --- a/gcc/internal-fn.cc
> +++ b/gcc/internal-fn.cc
> @@ -4171,6 +4171,12 @@ direct_internal_fn_optab (internal_fn fn)
> static bool
> type_strictly_matches_mode_p (const_tree type)
> {
> + /* For target=amdgcn-amdhsa, we need to take care of vector bool types.
> + More details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116103. */
> + if (VECTOR_BOOLEAN_TYPE_P (type) && SCALAR_INT_MODE_P (TYPE_MODE (type))
> + && TYPE_PRECISION (TREE_TYPE (type)) == 1)
Sorry for the formatting nits, but I think this should be:
if (VECTOR_BOOLEAN_TYPE_P (type)
&& SCALAR_INT_MODE_P (TYPE_MODE (type))
&& TYPE_PRECISION (TREE_TYPE (type)) == 1)
(one condition per line, indented below "VECTOR").
But I think the comment should give the underlying reason, rather than
treat it as a target oddity. Maybe something like:
/* Masked vector operations have both vector data operands and
vector boolean operands. The vector data operands are expected
to have a vector mode, but the vector boolean operands can be
an integer mode rather than a vector mode, depending on how
TARGET_VECTORIZE_GET_MASK_MODE is defined. */
Thanks,
Richard
> + return true;
> +
> if (VECTOR_TYPE_P (type))
> return VECTOR_MODE_P (TYPE_MODE (type));
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
2024-07-29 16:08 ` Richard Sandiford
@ 2024-07-30 3:10 ` Li, Pan2
0 siblings, 0 replies; 5+ messages in thread
From: Li, Pan2 @ 2024-07-30 3:10 UTC (permalink / raw)
To: Richard Sandiford
Cc: gcc-patches, juzhe.zhong, kito.cheng, richard.guenther,
tamar.christina, jeffreyalaw, rdapp.gcc
Thanks Richard S for comments, updated in v2.
https://gcc.gnu.org/pipermail/gcc-patches/2024-July/658637.html
Pan
-----Original Message-----
From: Richard Sandiford <richard.sandiford@arm.com>
Sent: Tuesday, July 30, 2024 12:09 AM
To: Li, Pan2 <pan2.li@intel.com>
Cc: gcc-patches@gcc.gnu.org; juzhe.zhong@rivai.ai; kito.cheng@gmail.com; richard.guenther@gmail.com; tamar.christina@arm.com; jeffreyalaw@gmail.com; rdapp.gcc@gmail.com
Subject: Re: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]
pan2.li@intel.com writes:
> From: Pan Li <pan2.li@intel.com>
>
> For some target like target=amdgcn-amdhsa, we need to take care of
> vector bool types prior to general vector mode types. Or we may have
> the asm check failure as below.
>
> gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_smin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80
> gcc.target/gcn/cond_umax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.target/gcn/cond_umin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56
> gcc.dg/tree-ssa/loop-bound-2.c scan-tree-dump-not ivopts "zero if "
>
> The below test suites are passed for this patch.
> 1. The rv64gcv fully regression tests.
> 2. The x86 bootstrap tests.
> 3. The x86 fully regression tests.
> 4. The amdgcn test case as above.
>
> gcc/ChangeLog:
>
> * internal-fn.cc (type_strictly_matches_mode_p): Add handling
> for vector bool type.
>
> Signed-off-by: Pan Li <pan2.li@intel.com>
> ---
> gcc/internal-fn.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
> index 8a2e07f2f96..086c8be398a 100644
> --- a/gcc/internal-fn.cc
> +++ b/gcc/internal-fn.cc
> @@ -4171,6 +4171,12 @@ direct_internal_fn_optab (internal_fn fn)
> static bool
> type_strictly_matches_mode_p (const_tree type)
> {
> + /* For target=amdgcn-amdhsa, we need to take care of vector bool types.
> + More details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116103. */
> + if (VECTOR_BOOLEAN_TYPE_P (type) && SCALAR_INT_MODE_P (TYPE_MODE (type))
> + && TYPE_PRECISION (TREE_TYPE (type)) == 1)
Sorry for the formatting nits, but I think this should be:
if (VECTOR_BOOLEAN_TYPE_P (type)
&& SCALAR_INT_MODE_P (TYPE_MODE (type))
&& TYPE_PRECISION (TREE_TYPE (type)) == 1)
(one condition per line, indented below "VECTOR").
But I think the comment should give the underlying reason, rather than
treat it as a target oddity. Maybe something like:
/* Masked vector operations have both vector data operands and
vector boolean operands. The vector data operands are expected
to have a vector mode, but the vector boolean operands can be
an integer mode rather than a vector mode, depending on how
TARGET_VECTORIZE_GET_MASK_MODE is defined. */
Thanks,
Richard
> + return true;
> +
> if (VECTOR_TYPE_P (type))
> return VECTOR_MODE_P (TYPE_MODE (type));
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-30 3:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-29 7:57 [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103] pan2.li
2024-07-29 8:44 ` Richard Biener
2024-07-29 12:24 ` Li, Pan2
2024-07-29 16:08 ` Richard Sandiford
2024-07-30 3:10 ` Li, Pan2
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).