[Bug target/85323] SSE/AVX/AVX512 shift by 0 not optimized away

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 11 11:48:00 GMT 2018


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.


More information about the Gcc-bugs mailing list