https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118361

            Bug ID: 118361
           Summary: [meta-bug] Expensive arithmetic instead of a simple
                    bit test
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

This PR collects PRs that suffer from very expensive code where a simple
test-bit-and-branch would be perfectly fine.

* Most of the PRs are NOT a "missed optimization" but have been introduced
DELIBERATELY like PR118012 in match.pd.

* On AVR, bit tests are cheap. No extra register pressure, no pipeline
disruption, etc.

* AVR is an 8-bit archtiecture without a barrel shifter.  AVR doesn't have MUL,
or multiplication like mulhi3 or mulsi3 is very expensive.  Even negsi2 is
expensive (costs 7 instructions and register pressure).  Signed / unsigned
bit-extraction is alse expensive, in particular when the are performed on the
full mode size.

* Many parts of the tree optimizers / match.pd don't even try to work out
costs.  Same for parts of the RTL lowering middel-end.

* RTX costs may be a bad proxy for real costs, e.g. a library call for mulsi3
is "just a CALL" but still ill when a bit test could do the job (and the source
spells out a bit test).

Reply via email to