-
- Downloads
Add match patterns for `a ? onezero : onezero` where one of the two operands are constant
This adds a match pattern that are for boolean values that optimizes `a ? onezero : 0` to `a & onezero` and `a ? 1 : onezero` to `a | onezero`. This was reported a few times and I thought I would finally add the match pattern for this. This hits a few times in GCC itself too. Notes on the testcases: * phi-opt-2.c: This now is optimized to `a & b` in phiopt rather than ifcombine * phi-opt-25b.c: The test part that was failing was parity which now gets `x & y` treatment. * ssa-thread-21.c: there is no longer a threading opportunity, so need to disable phiopt. Note PR 109957 is filed for the now missing optimization in that testcase too. gcc/ChangeLog: PR tree-optimization/89263 PR tree-optimization/99069 PR tree-optimization/20083 PR tree-optimization/94898 * match.pd: Add patterns to optimize `a ? onezero : onezero` with one of the operands are constant. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-2.c: Adjust the testcase. * gcc.dg/tree-ssa/phi-opt-25b.c: Adjust the testcase. * gcc.dg/tree-ssa/ssa-thread-21.c: Disable phiopt. * gcc.dg/tree-ssa/phi-opt-27.c: New test. * gcc.dg/tree-ssa/phi-opt-28.c: New test. * gcc.dg/tree-ssa/phi-opt-29.c: New test. * gcc.dg/tree-ssa/phi-opt-30.c: New test. * gcc.dg/tree-ssa/phi-opt-31.c: New test. * gcc.dg/tree-ssa/phi-opt-32.c: New test.
Showing
- gcc/match.pd 18 additions, 0 deletionsgcc/match.pd
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c 5 additions, 7 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c 5 additions, 3 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-27.c 14 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-27.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-28.c 14 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-28.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-29.c 25 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-29.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-30.c 55 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-30.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-31.c 15 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-31.c
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-32.c 12 additions, 0 deletionsgcc/testsuite/gcc.dg/tree-ssa/phi-opt-32.c
- gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-21.c 2 additions, 1 deletiongcc/testsuite/gcc.dg/tree-ssa/ssa-thread-21.c
Loading
Please register or sign in to comment