From: Stefan Schulze Frielinghaus <[email protected]>

Starting with r17-5047-gd2e1b1248a17d0 vector modes are passed to
C[LT]Z_DEFINED_VALUE_AT_ZERO.  Commits r17-5062-g6ae2ad3169a and
r17-5063-g3a4df843f91 restored the original behaviour for pru and vax by
looking through vector modes.  This patch does the same for nvptx.

gcc/ChangeLog:

        * config/nvptx/nvptx.h (CLZ_DEFINED_VALUE_AT_ZERO): Handle
        vector modes.
        (CTZ_DEFINED_VALUE_AT_ZERO): Ditto.
---
 My nvptx build experience is non-existing.  Nonetheless, if build for
 target nvptx-none I get

 In file included from ./tm.h:21,
                 from ../../gcc/gcc/backend.h:28,
                 from ../../gcc/gcc/tree-vect-patterns.cc:24:
 ../../gcc/gcc/tree-vect-patterns.cc: In function ‘gimple* 
vect_recog_ctz_ffs_pattern(vec_info*, stmt_vec_info, tree_node**)’:
 ../../gcc/gcc/config/nvptx/nvptx.h:328:31: error: cannot convert ‘poly_uint16’ 
{aka ‘poly_int<1, short unsigned int>’} to ‘int’ in assignment
   328 |   ((VALUE) = GET_MODE_BITSIZE ((MODE)), 2)
       |              ~~~~~~~~~~~~~~~~~^~~~~~~~
       |                               |
       |                               poly_uint16 {aka poly_int<1, short 
unsigned int>}

 which is fixed by this patch in the sense that `make all-gcc`
 succeeds.  Ok for mainline?

 gcc/config/nvptx/nvptx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 6ca981bf377..a881ed65007 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -323,9 +323,9 @@ struct GTY(()) machine_function
 #define DWARF2_LINENO_DEBUGGING_INFO 1
 
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
-  ((VALUE) = GET_MODE_BITSIZE ((MODE)), 2)
+  ((VALUE) = GET_MODE_UNIT_BITSIZE ((MODE)), 2)
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
-  ((VALUE) = GET_MODE_BITSIZE ((MODE)), 2)
+  ((VALUE) = GET_MODE_UNIT_BITSIZE ((MODE)), 2)
 
 #define SUPPORTS_WEAK 1
 
-- 
2.55.0

Reply via email to