public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8290] tree-optimization/112505 - bit-precision induction vectorization
@ 2024-02-06 13:20 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-02-06 13:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9895fc7ab14f4cf571071184877f130b7bd0a59b

commit r13-8290-g9895fc7ab14f4cf571071184877f130b7bd0a59b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 11 14:00:33 2024 +0100

    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.cc (vectorizable_induction): Reject
            bit-precision induction.
    
            * gcc.dg/vect/pr112505.c: New testcase.
    
    (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr112505.c | 14 ++++++++++++++
 gcc/tree-vect-loop.cc                |  9 +++++++++
 2 files changed, 23 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/vect/pr112505.c b/gcc/testsuite/gcc.dg/vect/pr112505.c
new file mode 100644
index 000000000000..56546c1095aa
--- /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.cc b/gcc/tree-vect-loop.cc
index d54c839779ae..fdadc2984e9e 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -9284,6 +9284,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. */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-06 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06 13:20 [gcc r13-8290] tree-optimization/112505 - bit-precision induction vectorization Richard Biener

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).