* [PATCH] Add MD Function type check for builtin_md vectorize
@ 2019-08-21 7:56 Xiong Hu Luo
2019-08-21 7:59 ` Richard Biener
0 siblings, 1 reply; 3+ messages in thread
From: Xiong Hu Luo @ 2019-08-21 7:56 UTC (permalink / raw)
To: gcc-patches; +Cc: richard.sandiford, rguenth, segher, wschmidt, luoxhu
The DECL_MD_FUNCTION_CODE added in r274404(PR 91421) by rsandifo requires that
DECL to be a BUILTIN_IN_MD class built-in, asserts will happen when lto
as the patch r274411(PR 91287) outputs some math function symbol to the object,
this patch will check function type before do builtin_md vectorize.
gcc/ChangeLog
2019-08-21 Xiong Hu Luo <luoxhu@linux.ibm.com>
* tree-vect-stmts.c (vectorizable_call): Check callee built-in type.
* gcc/tree.h (DECL_MD_FUNCTION_P): New function.
---
gcc/tree-vect-stmts.c | 2 +-
gcc/tree.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 1e2dfe5d22d..ef947f20d63 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3376,7 +3376,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (cfn != CFN_LAST)
fndecl = targetm.vectorize.builtin_vectorized_function
(cfn, vectype_out, vectype_in);
- else if (callee)
+ else if (callee && DECL_MD_FUNCTION_P (callee))
fndecl = targetm.vectorize.builtin_md_vectorized_function
(callee, vectype_out, vectype_in);
}
diff --git a/gcc/tree.h b/gcc/tree.h
index b910c5cb475..8cce89e5cf3 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3905,6 +3905,18 @@ DECL_MD_FUNCTION_CODE (const_tree decl)
return fndecl.function_code;
}
+/* Return true if decl is a FUNCTION_DECL with built-in class BUILT_IN_MD.
+ Otherwise return false. */
+inline bool
+DECL_MD_FUNCTION_P (const_tree decl)
+{
+ const tree_function_decl &fndecl = FUNCTION_DECL_CHECK (decl)->function_decl;
+ if (fndecl.built_in_class == BUILT_IN_MD)
+ return true;
+ else
+ return false;
+}
+
/* Return the frontend-specific built-in function that DECL represents,
given that it is known to be a FUNCTION_DECL with built-in class
BUILT_IN_FRONTEND. */
--
2.22.0.428.g6d5b264208
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add MD Function type check for builtin_md vectorize
2019-08-21 7:56 [PATCH] Add MD Function type check for builtin_md vectorize Xiong Hu Luo
@ 2019-08-21 7:59 ` Richard Biener
2019-08-22 5:48 ` luoxhu
0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2019-08-21 7:59 UTC (permalink / raw)
To: Xiong Hu Luo; +Cc: gcc-patches, richard.sandiford, rguenth, segher, wschmidt
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
On Tue, 20 Aug 2019, Xiong Hu Luo wrote:
> The DECL_MD_FUNCTION_CODE added in r274404(PR 91421) by rsandifo requires that
> DECL to be a BUILTIN_IN_MD class built-in, asserts will happen when lto
> as the patch r274411(PR 91287) outputs some math function symbol to the object,
> this patch will check function type before do builtin_md vectorize.
I think Richard fixed this already.
Richard.
> gcc/ChangeLog
>
> 2019-08-21 Xiong Hu Luo <luoxhu@linux.ibm.com>
>
> * tree-vect-stmts.c (vectorizable_call): Check callee built-in type.
> * gcc/tree.h (DECL_MD_FUNCTION_P): New function.
> ---
> gcc/tree-vect-stmts.c | 2 +-
> gcc/tree.h | 12 ++++++++++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
> index 1e2dfe5d22d..ef947f20d63 100644
> --- a/gcc/tree-vect-stmts.c
> +++ b/gcc/tree-vect-stmts.c
> @@ -3376,7 +3376,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
> if (cfn != CFN_LAST)
> fndecl = targetm.vectorize.builtin_vectorized_function
> (cfn, vectype_out, vectype_in);
> - else if (callee)
> + else if (callee && DECL_MD_FUNCTION_P (callee))
> fndecl = targetm.vectorize.builtin_md_vectorized_function
> (callee, vectype_out, vectype_in);
> }
> diff --git a/gcc/tree.h b/gcc/tree.h
> index b910c5cb475..8cce89e5cf3 100644
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -3905,6 +3905,18 @@ DECL_MD_FUNCTION_CODE (const_tree decl)
> return fndecl.function_code;
> }
>
> +/* Return true if decl is a FUNCTION_DECL with built-in class BUILT_IN_MD.
> + Otherwise return false. */
> +inline bool
> +DECL_MD_FUNCTION_P (const_tree decl)
> +{
> + const tree_function_decl &fndecl = FUNCTION_DECL_CHECK (decl)->function_decl;
> + if (fndecl.built_in_class == BUILT_IN_MD)
> + return true;
> + else
> + return false;
> +}
> +
> /* Return the frontend-specific built-in function that DECL represents,
> given that it is known to be a FUNCTION_DECL with built-in class
> BUILT_IN_FRONTEND. */
>
--
Richard Biener <rguenther@suse.de>
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany;
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah; HRB 21284 (AG NÌrnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add MD Function type check for builtin_md vectorize
2019-08-21 7:59 ` Richard Biener
@ 2019-08-22 5:48 ` luoxhu
0 siblings, 0 replies; 3+ messages in thread
From: luoxhu @ 2019-08-22 5:48 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches, richard.sandiford, rguenth, segher, wschmidt
On 2019/8/21 15:40, Richard Biener wrote:
> On Tue, 20 Aug 2019, Xiong Hu Luo wrote:
>
>> The DECL_MD_FUNCTION_CODE added in r274404(PR 91421) by rsandifo requires that
>> DECL to be a BUILTIN_IN_MD class built-in, asserts will happen when lto
>> as the patch r274411(PR 91287) outputs some math function symbol to the object,
>> this patch will check function type before do builtin_md vectorize.
>
> I think Richard fixed this already.
Thanks. It was fixed by Richard's r274524 already. Please ignore this
patch.
Xionghu
>
> Richard.
>
>> gcc/ChangeLog
>>
>> 2019-08-21 Xiong Hu Luo <luoxhu@linux.ibm.com>
>>
>> * tree-vect-stmts.c (vectorizable_call): Check callee built-in type.
>> * gcc/tree.h (DECL_MD_FUNCTION_P): New function.
>> ---
>> gcc/tree-vect-stmts.c | 2 +-
>> gcc/tree.h | 12 ++++++++++++
>> 2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
>> index 1e2dfe5d22d..ef947f20d63 100644
>> --- a/gcc/tree-vect-stmts.c
>> +++ b/gcc/tree-vect-stmts.c
>> @@ -3376,7 +3376,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
>> if (cfn != CFN_LAST)
>> fndecl = targetm.vectorize.builtin_vectorized_function
>> (cfn, vectype_out, vectype_in);
>> - else if (callee)
>> + else if (callee && DECL_MD_FUNCTION_P (callee))
>> fndecl = targetm.vectorize.builtin_md_vectorized_function
>> (callee, vectype_out, vectype_in);
>> }
>> diff --git a/gcc/tree.h b/gcc/tree.h
>> index b910c5cb475..8cce89e5cf3 100644
>> --- a/gcc/tree.h
>> +++ b/gcc/tree.h
>> @@ -3905,6 +3905,18 @@ DECL_MD_FUNCTION_CODE (const_tree decl)
>> return fndecl.function_code;
>> }
>>
>> +/* Return true if decl is a FUNCTION_DECL with built-in class BUILT_IN_MD.
>> + Otherwise return false. */
>> +inline bool
>> +DECL_MD_FUNCTION_P (const_tree decl)
>> +{
>> + const tree_function_decl &fndecl = FUNCTION_DECL_CHECK (decl)->function_decl;
>> + if (fndecl.built_in_class == BUILT_IN_MD)
>> + return true;
>> + else
>> + return false;
>> +}
>> +
>> /* Return the frontend-specific built-in function that DECL represents,
>> given that it is known to be a FUNCTION_DECL with built-in class
>> BUILT_IN_FRONTEND. */
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-22 2:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-21 7:56 [PATCH] Add MD Function type check for builtin_md vectorize Xiong Hu Luo
2019-08-21 7:59 ` Richard Biener
2019-08-22 5:48 ` luoxhu
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).