https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95969
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Created attachment 51396 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51396&action=edit Patch Simple patch which adds both generic and gimple level folding for __builtin_aarch64_im_lane_boundsi. In this case (and most likely others), __builtin_aarch64_im_lane_boundsi is removed during early inlining so it will fix the majority of the issue.