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

            Bug ID: 85551
           Summary: No strength reduction of modulo and integer vision
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linux at carewolf dot com
  Target Milestone: ---

Created attachment 44030
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44030&action=edit
strmod.cpp

Many simple loops using modulo naively can be optimized too not perform the
expensive module/division every iterations, but GCC does not perform this
strength reduction.

I have attached a motivating example including two iterations of optimizations.
An easy safe one (though it might interfere with vectorization if the arch has
vectorized integer divisions), and a more agressive one that is much faster in
some cases but not always.

Reply via email to