https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108410
--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 12 Jun 2023, crazylht at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108410 > > --- Comment #6 from Hongtao.liu <crazylht at gmail dot com> --- > > > and the key thing to optimize is > > > > ivtmp_78 = ivtmp_77 + 4294967232; // -64 > > _79 = MIN_EXPR <ivtmp_78, 255>; > > _80 = (unsigned char) _79; > > _81 = {_80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, > > _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, > > _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, > > _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, > > _80, _80, _80, _80, _80, _80}; > > > > that is we want to broadcast a saturated (to vector element precision) > > value. > > Yes, backend needs to support vec_pack_ssat_m, vec_pack_usat_m. Can x86 do this? We'd want to apply this to a scalar, so move ivtmp to xmm, apply pack_usat or as you say below, the non-existing us_trunc and then broadcast.