https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123107
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:ae0cdb01b08fb4929ef17c534f86cd9fae78e799 commit r16-6569-gae0cdb01b08fb4929ef17c534f86cd9fae78e799 Author: Richard Biener <[email protected]> Date: Wed Jan 7 13:18:42 2026 +0100 middle-end/123107 - avoid invalid vector folding We fold (v >> CST) == { 0, 0.. } into v < { 0, 0.. } but fail to validate that's valid for the target. The following adds such check, making sure to apply after IPA (due to offloading) and only when the original form wasn't valid for the target (like before vector lowering) or when the new form is. In particular in this case we have an equality compare resulting in a non-vector which we can handle, but a similar LT/GT is never handled. PR middle-end/123107 * fold-const.cc (fold_binary_loc): Guard (v >> CST) == { 0, 0.. } to v < { 0, 0.. } folding. * gcc.dg/torture/pr123107.c: New testcase.
