Skip to content

Commit

Permalink
tree-optimization/112505 - bit-precision induction vectorization
Browse files Browse the repository at this point in the history
Vectorization of bit-precision inductions isn't implemented but we
don't check this, instead we ICE during transform.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	PR tree-optimization/112505
	* tree-vect-loop.cc (vectorizable_induction): Reject
	bit-precision induction.

	* gcc.dg/vect/pr112505.c: New testcase.
  • Loading branch information
rguenth authored and ouuleilei-bot committed Jan 11, 2024
1 parent c2d62cd commit c679123
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gcc/testsuite/gcc.dg/vect/pr112505.c
Original file line number Diff line number Diff line change
@@ -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;
}
9 changes: 9 additions & 0 deletions gcc/tree-vect-loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9273,6 +9273,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. */
Expand Down

0 comments on commit c679123

Please sign in to comment.