diff options
author | Richard Biener <rguenther@suse.de> | 2024-01-11 14:00:33 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2024-06-21 11:21:07 +0200 |
commit | ffaa61eb15dce3e48b4dcbca7161fc79ac9734b8 (patch) | |
tree | f834a5dc08b8bc1e4a834e62e7a039acdf2f6799 | |
parent | 33e6997ef0ea30f57089038a15e2a33fcbd81648 (diff) | |
download | gcc-ffaa61eb15dce3e48b4dcbca7161fc79ac9734b8.zip gcc-ffaa61eb15dce3e48b4dcbca7161fc79ac9734b8.tar.gz gcc-ffaa61eb15dce3e48b4dcbca7161fc79ac9734b8.tar.bz2 |
tree-optimization/112505 - bit-precision induction vectorization
Vectorization of bit-precision inductions isn't implemented but we
don't check this, instead we ICE during transform.
PR tree-optimization/112505
* tree-vect-loop.c (vectorizable_induction): Reject
bit-precision induction.
* gcc.dg/vect/pr112505.c: New testcase.
(cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr112505.c | 14 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr112505.c b/gcc/testsuite/gcc.dg/vect/pr112505.c new file mode 100644 index 0000000..56546c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr112505.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ + +short int w9; +struct T { + short a : 14; + int b; +}; +struct T v; +void zc() +{ + for(int i = 0; i < 4; i ++) + w9 *= v.b ? v.a-- < 0 : 0; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 48dbdc2..0c1f7e4 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8032,6 +8032,15 @@ vectorizable_induction (loop_vec_info loop_vinfo, step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_info); gcc_assert (step_expr != NULL_TREE); + if (INTEGRAL_TYPE_P (TREE_TYPE (step_expr)) + && !type_has_mode_precision_p (TREE_TYPE (step_expr))) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "bit-precision induction vectorization not " + "supported.\n"); + return false; + } tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype); /* Check for backend support of PLUS/MINUS_EXPR. */ |