https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65930
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #8) > Note the tricky part is not so much the loop vectorization (teaching > reduction path support about the conversion is not difficult with the twist > that we > need to handle conversions as reduction code...) but the vector epilogue > which > does the lane reduction in signed int exposing undefined overflow issues. > > Of course the vectorizer doesn't seem to care here anyways and vectorizes > signed integer reductions without caring for that specific issue... > > In general feeding the conversion as reduction operation through the > vectorizer > is a bit awkward so pattern-recognizing this as > > int tem = (int)x[i]; > sum += tem; > > would be easier given we seem to ignore the undefined overflow issues... but pattern recog runs after reduction detection (and that's not easy to change).