Message ID | 20240730030850.3983878-1-pan2.li@intel.com |
---|---|
State | New |
Headers | show |
Series | [v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] | expand |
On Tue, Jul 30, 2024 at 5:08 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. Still 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 | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc > index 8a2e07f2f96..966594a52ed 100644 > --- a/gcc/internal-fn.cc > +++ b/gcc/internal-fn.cc > @@ -4171,6 +4171,16 @@ direct_internal_fn_optab (internal_fn fn) > static bool > type_strictly_matches_mode_p (const_tree type) > { > + /* The 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. PR116103. */ > + 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 >
> Still OK. Thanks Richard, let me wait the final confirmation from Richard S. Pan -----Original Message----- From: Richard Biener <richard.guenther@gmail.com> Sent: Tuesday, July 30, 2024 5:03 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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] On Tue, Jul 30, 2024 at 5:08 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. Still 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 | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc > index 8a2e07f2f96..966594a52ed 100644 > --- a/gcc/internal-fn.cc > +++ b/gcc/internal-fn.cc > @@ -4171,6 +4171,16 @@ direct_internal_fn_optab (internal_fn fn) > static bool > type_strictly_matches_mode_p (const_tree type) > { > + /* The 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. PR116103. */ > + 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 >
Hi Richard S, Please feel free to let me know if there is any further comments in v2. Thanks a lot. Pan -----Original Message----- From: Li, Pan2 Sent: Thursday, August 1, 2024 8:11 PM To: Richard Biener <richard.guenther@gmail.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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] > Still OK. Thanks Richard, let me wait the final confirmation from Richard S. Pan -----Original Message----- From: Richard Biener <richard.guenther@gmail.com> Sent: Tuesday, July 30, 2024 5:03 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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] On Tue, Jul 30, 2024 at 5:08 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. Still 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 | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc > index 8a2e07f2f96..966594a52ed 100644 > --- a/gcc/internal-fn.cc > +++ b/gcc/internal-fn.cc > @@ -4171,6 +4171,16 @@ direct_internal_fn_optab (internal_fn fn) > static bool > type_strictly_matches_mode_p (const_tree type) > { > + /* The 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. PR116103. */ > + 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 >
"Li, Pan2" <pan2.li@intel.com> writes: > Hi Richard S, > > Please feel free to let me know if there is any further comments in v2. Thanks a lot. Looks good to me too. Sorry, didn't realise you were waiting for a second ack. Thanks, Richard > > Pan > > > -----Original Message----- > From: Li, Pan2 > Sent: Thursday, August 1, 2024 8:11 PM > To: Richard Biener <richard.guenther@gmail.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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] > >> Still OK. > > Thanks Richard, let me wait the final confirmation from Richard S. > > Pan > > -----Original Message----- > From: Richard Biener <richard.guenther@gmail.com> > Sent: Tuesday, July 30, 2024 5:03 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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] > > On Tue, Jul 30, 2024 at 5:08 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. > > Still 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 | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc >> index 8a2e07f2f96..966594a52ed 100644 >> --- a/gcc/internal-fn.cc >> +++ b/gcc/internal-fn.cc >> @@ -4171,6 +4171,16 @@ direct_internal_fn_optab (internal_fn fn) >> static bool >> type_strictly_matches_mode_p (const_tree type) >> { >> + /* The 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. PR116103. */ >> + 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 >>
> Looks good to me too. Sorry, didn't realise you were waiting for a second ack. Never mind, thanks Richard S for confirmation and suggestions. Pan -----Original Message----- From: Richard Sandiford <richard.sandiford@arm.com> Sent: Tuesday, August 13, 2024 5:25 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; Richard Biener <richard.guenther@gmail.com> Subject: Re: [PATCH v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] "Li, Pan2" <pan2.li@intel.com> writes: > Hi Richard S, > > Please feel free to let me know if there is any further comments in v2. Thanks a lot. Looks good to me too. Sorry, didn't realise you were waiting for a second ack. Thanks, Richard > > Pan > > > -----Original Message----- > From: Li, Pan2 > Sent: Thursday, August 1, 2024 8:11 PM > To: Richard Biener <richard.guenther@gmail.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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] > >> Still OK. > > Thanks Richard, let me wait the final confirmation from Richard S. > > Pan > > -----Original Message----- > From: Richard Biener <richard.guenther@gmail.com> > Sent: Tuesday, July 30, 2024 5:03 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 v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103] > > On Tue, Jul 30, 2024 at 5:08 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. > > Still 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 | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc >> index 8a2e07f2f96..966594a52ed 100644 >> --- a/gcc/internal-fn.cc >> +++ b/gcc/internal-fn.cc >> @@ -4171,6 +4171,16 @@ direct_internal_fn_optab (internal_fn fn) >> static bool >> type_strictly_matches_mode_p (const_tree type) >> { >> + /* The 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. PR116103. */ >> + 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 >>
diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc index 8a2e07f2f96..966594a52ed 100644 --- a/gcc/internal-fn.cc +++ b/gcc/internal-fn.cc @@ -4171,6 +4171,16 @@ direct_internal_fn_optab (internal_fn fn) static bool type_strictly_matches_mode_p (const_tree type) { + /* The 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. PR116103. */ + 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));