https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109011
--- Comment #11 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Jakub Jelinek from comment #3) > Seems they are vectorizing __builtin_ctz (x) as bitsize - .CLZ ((x - 1) & > ~x) for CLZ_DEFINED_VALUE_AT_ZERO 2 with value bitsize. > Perhaps we should pattern match it in tree-vect-patterns.cc that way if clz > is vectorizable (it is with -mavx512cd) and ctz is not. Yes, I'm going to add a pattern match named vect_recog_ctz_as_clz_or_popcnt. BTW, It looks like only x86 have vector clz but not ctz, for other targets, they either have both or neither.