https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103771
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2022-01-13 CC| |rguenth at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Tamar Christina from comment #1) > Looks like the change causes the simpler conditional to be detected by the > vectorizer as a masked operation, which in principle makes sense: > > note: vect_recog_mask_conversion_pattern: detected: iftmp.0_21 = x.1_14 > > 255 ? iftmp.0_19 : iftmp.0_20; > note: mask_conversion pattern recognized: patt_43 = patt_42 ? iftmp.0_19 : > iftmp.0_20; > note: extra pattern stmt: patt_40 = x.1_14 > 255; > note: extra pattern stmt: patt_42 = (<signed-boolean:8>) patt_40; if we look at the ifcvt result we see iftmp.0_19 = (unsigned char) _18; iftmp.0_20 = (unsigned char) _5; iftmp.0_21 = x.1_14 > 255 ? iftmp.0_19 : iftmp.0_20; *_6 = iftmp.0_21; I suspect we intended to carry the fact that x.1_14 > 255 will produce a mask from a SImode vector element compare but we need a mask suitable for a QImode vector element select (iftmp.0_19 and iftmp.0_20). That's not something we can express in scalar code and thus a pattern I think. So the pattern as generated doesn't make very much sense to me. I suppose it might try to convert a AVX512 mask to a AVX2 style mask but that needs to be done with patt_42 = patt_40 ? (<signed-boolean:8>)-1 : 0; not with a conversion. But it's also somewhat pointless since it will simply cause the same issue again - the COND_EXPR vectorization will need to cobble up 4 AVX512 masks to produce the desired result.