https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116738
--- Comment #20 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:cc40795d8956d78e719a6acc83d5abad7032a6c3 commit r15-3876-gcc40795d8956d78e719a6acc83d5abad7032a6c3 Author: Jakub Jelinek <ja...@redhat.com> Date: Wed Sep 25 20:17:11 2024 +0200 i386: Add GENERIC and GIMPLE folders of __builtin_ia32_{min,max}* [PR116738] The following patch adds GENERIC and GIMPLE folders for various x86 min/max builtins. As discussed, these builtins have effectively x < y ? x : y (or x > y ? x : y) behavior. The GENERIC folding is done if all the (relevant) arguments are constants (such as VECTOR_CST for vectors) and is done because the GIMPLE folding can't easily handle masking, rounding and the ss/sd cases (in a way that it would be pattern recognized back to the corresponding instructions). The GIMPLE folding is also done just for TARGET_SSE4 or later when optimizing, otherwise it is apparently not matched back. 2024-09-25 Jakub Jelinek <ja...@redhat.com> PR target/116738 * config/i386/i386.cc (ix86_fold_builtin): Handle IX86_BUILTIN_M{IN,AX}{S,P}{S,H,D}*. (ix86_gimple_fold_builtin): Handle IX86_BUILTIN_M{IN,AX}P{S,H,D}*. * gcc.target/i386/avx512f-pr116738-1.c: New test. * gcc.target/i386/avx512f-pr116738-2.c: New test.