https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110897
--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to JuzheZhong from comment #18) > (In reply to JuzheZhong from comment #17) > > Confirm by this try: > > https://godbolt.org/z/q7zx5zG5e > > > > Both ARM SVE trunk GCC and RISC-V GCC failed to vectorize simple > > unsigned short shift right, with following failed information: > > > > <source>:14:1: missed: couldn't vectorize loop > > <source>:14:1: missed: not vectorized: relevant stmt not supported: patt_47 > > = MIN_EXPR <_7, 15>; > > Compiler returned: 0 > > > > This following code can fix it: > > > > index 2cedf2384..cda27fed9 100644 > > --- a/riscv-gcc/gcc/tree-vect-patterns.cc > > +++ b/riscv-gcc/gcc/tree-vect-patterns.cc > > @@ -3133,7 +3133,8 @@ vect_recog_over_widening_pattern (vec_info *vinfo, > > return NULL; > > } > > else > > - append_pattern_def_seq (vinfo, last_stmt_info, pattern_stmt); > > + append_pattern_def_seq (vinfo, last_stmt_info, pattern_stmt, > > + op_vectype); > > ops[1] = new_var; > > } > > } > > > > > > Bootstrap and Regression in progress, Ok for trunk ? > > Bootstrap and regression on X86 passed. We generally want to avoid setting a vector type during pattern recog esp. for BB vectorization. It will tie later analysis hands. Why does the later analysis not figure out the "proper" vector type? Oh. We force it to the vector type of the final pattern stmt ... (not sure why we do this ...). The patch is OK, sorry for missing this.