https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98877
--- Comment #11 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #10) > (In reply to Tamar Christina from comment #9) > > While RA should be able to deal with this, > > shouldn't we also just lower TBLs in gimple? > > > > This no reason why this can't be a VEC_PERM_EXPR which would also get the > > copies > > removed at the gimple level and allows us to optimize this to something else > > depending on the index. > > Yes there is a reason, `out of range` values for VEC_PERM is undefined while > tbl is well defined ( If an index is out of range for the table, the result > for that lookup is 0.). > I don't think that's not a good reason. The out of range values can be made implementation defined. i.e. mid-end shouldn't care about them. not lowering this in gimple means we lose a heck of a lot of optimizations that are impossible to cover in RTL.