From: "Jon Beniston" <jon@beniston.com>
To: "'Richard Biener'" <rguenther@suse.de>
Cc: <gcc-patches@gcc.gnu.org>
Subject: RE: [RFC, vectorizer] Allow single element vector types for vector reduction operations
Date: Wed, 30 Aug 2017 15:52:00 -0000 [thread overview]
Message-ID: <00ba01d321a2$3fd81260$bf883720$@beniston.com> (raw)
In-Reply-To: <alpine.LSU.2.20.1708301303500.14191@zhemvz.fhfr.qr>
Hi Richard,
> I think the issue is that with TARGET_VECTOR_MODE_SUPPORTED_P false
> for V1SI you'll get a SImode vector type and the
>
> if (VECTOR_BOOLEAN_TYPE_P (type_in)
> || VECTOR_MODE_P (TYPE_MODE (type_in)))
>
>check fails. Try changing that to || VECTOR_TYPE_P (type_in).
>The else path should be hopefully dead ...
>
>> It looks to me like the other call sites of optab_for_tree_code which
>> are passing optab_default are mostly places where GCC is sure it is
>> not a shift operation.
>> Given TYPE_IN is returned from get_vectype_for_scalar_type, is it
>> safe to simply pass optab_vector in vect_pattern_recog_1?
>
>I guess so. Can you also try the above?
Changing VECTOR_MODE_P check into VECTOR_TYPE_P check also works for me, I
verified the following patch could vectorize my dot product case and there
is no regression on gcc tests on my port.
Meanwhile x86-64 bootstraps OK and no regression on gcc/g++ test.
Does this look OK?
gcc/
2017-08-30 Jon Beniston <jon@beniston.com>
Richard Biener <rguenther@suse.de>
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index cfdb72c..5ebeac2 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -4150,7 +4150,7 @@ vect_pattern_recog_1 (vect_recog_func *recog_func,
loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
if (VECTOR_BOOLEAN_TYPE_P (type_in)
- || VECTOR_MODE_P (TYPE_MODE (type_in)))
+ || VECTOR_TYPE_P (type_in))
{
/* No need to check target support (already checked by the pattern
recognition function). */
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 013fb1f..fc62efb 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -9098,7 +9098,8 @@ get_vectype_for_scalar_type_and_size (tree
scalar_type, unsigned size)
else
simd_mode = mode_for_vector (inner_mode, size / nbytes);
nunits = GET_MODE_SIZE (simd_mode) / nbytes;
- if (nunits <= 1)
+ /* NOTE: nunits == 1 is allowed to support single element vector types.
*/
+ if (nunits < 1)
return NULL_TREE;
vectype = build_vector_type (scalar_type, nunits);
next prev parent reply other threads:[~2017-08-30 15:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 8:22 Jon Beniston
2017-08-28 8:29 ` Richard Biener
2017-08-28 9:04 ` Jon Beniston
2017-08-28 11:41 ` Richard Biener
2017-08-30 11:13 ` Jon Beniston
2017-08-30 12:28 ` Richard Biener
2017-08-30 15:52 ` Jon Beniston [this message]
2017-08-30 16:32 ` Richard Biener
2017-08-30 20:42 ` Richard Sandiford
2017-09-02 21:58 ` Andreas Schwab
2017-09-04 8:58 ` Tamar Christina
2017-09-04 9:19 ` Richard Biener
2017-09-04 14:28 ` Tamar Christina
2017-09-04 16:48 ` Andrew Pinski
2017-09-05 9:37 ` Richard Biener
2017-09-05 10:24 ` Tamar Christina
2017-09-05 10:41 ` Richard Biener
2017-09-05 12:50 ` Richard Biener
2017-09-05 13:06 ` Tamar Christina
2017-09-05 13:12 ` Richard Biener
2017-09-05 14:00 ` Tamar Christina
2017-09-11 15:39 ` Vidya Praveen
2017-09-12 7:13 ` Richard Biener
2017-09-12 8:45 ` Tamar Christina
2017-09-12 9:03 ` Richard Biener
2017-09-12 10:50 ` Richard Biener
2017-09-12 16:26 ` Andreas Schwab
2017-09-12 16:36 ` Richard Biener
2017-09-12 17:13 ` Tamar Christina
2017-09-04 15:04 ` Christophe Lyon
2017-09-07 11:08 ` Bernd Schmidt
2017-09-07 11:20 ` Jon Beniston
2017-09-07 14:42 ` Richard Biener
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='00ba01d321a2$3fd81260$bf883720$@beniston.com' \
--to=jon@beniston.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).