[Bug c++/105731] New: superfluous second operation before conditional branch -O2 -mcpu=cortex-m0plus

bugzilla@little-bat.de gcc-bugzilla@gcc.gnu.org
Wed May 25 20:20:52 GMT 2022


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

            Bug ID: 105731
           Summary: superfluous second operation before conditional branch
                      -O2 -mcpu=cortex-m0plus
           Product: gcc
           Version: og10 (devel/omp/gcc-10)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugzilla@little-bat.de
  Target Milestone: ---

gcc 10.3.1 misses an easy oportunity for optimization:

Instruction:  
    if ((bits<<=1)>=0) goto p3;

generated code:
    strh    r7, [r0, #4]
    lsls    r3, r2, #1
    lsls    r2, r2, #1
    bpl     .L8

i believe the 2nd "lsls" is superfluous. 
It would save me 3MHz if it wasn't there. :-)

full example: 
    https://godbolt.org/z/xocbvjn5x


More information about the Gcc-bugs mailing list