[Bug rtl-optimization/94344] New: Rotate pattern not recognized anymore

stefansf at linux dot ibm.com gcc-bugzilla@gcc.gnu.org
Thu Mar 26 16:14:14 GMT 2020


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

            Bug ID: 94344
           Summary: Rotate pattern not recognized anymore
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefansf at linux dot ibm.com
  Target Milestone: ---

Consider the following MWE:

int64_t f (int64_t x)                                                           
{                                                                               
  int64_t y = x & -49;                                                          
  return (y << 5) | (int64_t)((uint64_t)y >> 59);                               
}

Prior to patch c4c5ad1d6d1 combine successfully recognized the rotate pattern
and suggested amongst other the following insn (using `gcc -O3 -S
-fdump-rtl-combine-details test.c`):

(set (reg:DI 67)                                                                
    (rotate:DI (reg/v:DI 64 [ y ])                                              
        (const_int 5 [0x5])))

However, with patch c4c5ad1d6d1 applied, this is not the case anymore. Thus,
only combinations of shifts+and+ior are emitted.

This is reproducible for s390x on HEAD (16948c54b75) by simply reverting the
patch. Any idea how we could tweak combine back to the old behaviour where it
detected a rotate successfully?


More information about the Gcc-bugs mailing list