https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66002
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-05-04 Blocks| |53947 Ever confirmed|0 |1 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- prephitmp_61 = _53 <= 65535 ? pretmp_60 : -32768; is unsigned int <= 65535 ? short int : short int; pushing the condition to a separate stmt might get us to support this "narrowing" conversion. Of course ifcvt does a pretty poor job on this as well... We do vectorize for (int i=0; i<n; ++i) { int wt=w[i]+((t[i]*err*2>>16)+1>>1); if (wt<-32768) wt=-32768; // if (wt>32767) wt=32767; w[i]=wt; } as if (wt<-32768) wt=-32768; becomes a MAX_EXPR. Also if I change it to for (int i=0; i<n; ++i) { int wt=w[i]+((t[i]*err*2>>16)+1>>1); if (wt<-32768) wt=-32768; else if (wt>32767) wt=32767; w[i]=wt; } we vectorize it as MIN/MAX_EXPRs. Maybe you can perform this source change manually and see what it does to performance. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations