https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123778
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:0cdcc61fb9976b9f6ba2fbf5e9211c3e23a9799c commit r16-7004-g0cdcc61fb9976b9f6ba2fbf5e9211c3e23a9799c Author: Andrew Pinski <[email protected]> Date: Thu Jan 22 23:12:42 2026 -0800 match: Fix some `(op (cnd @0 @1 @2) @3)` patterns [PR123778] All of these patterns have in common is they try to move the op inside the cnd if it simplifies. The problem is the type of the op does not need to be the type of first operand and instead is the type of the type variable. The fix is to supply the type to the op like in `(op:type @1 @3)`. But since they were originally in the `(op! @1 @3)`, it should be: `(op!:type @1 @3)`. Though this would be rejected as we don't pick up the next token after parsing the `!` (note `^` has the same issue which is also fixed here too). Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/123778 gcc/ChangeLog: * genmatch.cc (parser::parse_expr): Peek on the next token after eating the `!` or `^`. * match.pd (`(op (cnd @0 @1 @2) @3)`, `(op @3 (cnd @0 @1 @2))`): Add the type to resulting op. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr123778-1.c: New test. Signed-off-by: Andrew Pinski <[email protected]>
