MATCH: Add simplifications of `(a == CST) & a`
`(a == CST) & a` can be either simplified to simplying `a == CST` or 0 depending on the first bit of the CST. This is an extension of the already pattern of `X & !X` and allows us to remove the 2 xfails on gcc.dg/binop-notand1a.c and gcc.dg/binop-notand4a.c. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/111431 gcc/ChangeLog: * match.pd (`(a == CST) & a`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/binop-notand1a.c: Remove xfail. * gcc.dg/binop-notand4a.c: Likewise. * gcc.c-torture/execute/pr111431-1.c: New test. * gcc.dg/binop-andeq1.c: New test. * gcc.dg/binop-andeq2.c: New test. * gcc.dg/binop-notand7.c: New test. * gcc.dg/binop-notand7a.c: New test.
Showing
- gcc/match.pd 8 additions, 0 deletionsgcc/match.pd
- gcc/testsuite/gcc.c-torture/execute/pr111431-1.c 39 additions, 0 deletionsgcc/testsuite/gcc.c-torture/execute/pr111431-1.c
- gcc/testsuite/gcc.dg/binop-andeq1.c 12 additions, 0 deletionsgcc/testsuite/gcc.dg/binop-andeq1.c
- gcc/testsuite/gcc.dg/binop-andeq2.c 14 additions, 0 deletionsgcc/testsuite/gcc.dg/binop-andeq2.c
- gcc/testsuite/gcc.dg/binop-notand1a.c 1 addition, 3 deletionsgcc/testsuite/gcc.dg/binop-notand1a.c
- gcc/testsuite/gcc.dg/binop-notand4a.c 1 addition, 3 deletionsgcc/testsuite/gcc.dg/binop-notand4a.c
- gcc/testsuite/gcc.dg/binop-notand7.c 12 additions, 0 deletionsgcc/testsuite/gcc.dg/binop-notand7.c
- gcc/testsuite/gcc.dg/binop-notand7a.c 12 additions, 0 deletionsgcc/testsuite/gcc.dg/binop-notand7a.c
Loading
Please register or sign in to comment