https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85323
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If you mean adding if (__builtin_constant_p (__B) && __B == 0) return __A; and similar to all the various intrinsics, then that is not the right thing to do, it will make the headers much larger and even the IL much larger for the common case where people aren't using 0 constant. Doing this in in the fold target hooks is easier and more effective. Note, Matthias has filed a bunch of other PRs for similar issues recently, perhaps we want some tracker PR for those. The general rule is that foldings which result in VECTOR_CST or other constants should probably go into ix86_fold_builtin, and other foldings should go into ix86_gimple_fold_builtin.