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

            Bug ID: 114004
           Summary: GCC emits a superfluous instruction for simple test
                    case on ppc
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

We emit a superfluous rldicl insn for the following test case.  The rlwinm is
all that is needed/required.  This is not a regression.

bergner@ltcden2-lp1:PR112103$ cat bug.c 
unsigned int
rot (unsigned int x)
{
 return x & 0xbfffffff;
}
bergner@ltcden2-lp1:PR112103$ /opt/gcc-nightly/trunk/bin/gcc -S -O2 bug.c 
bergner@ltcden2-lp1:PR112103$ cat bug.s 
        .file   "bug.c"
        .machine power10
        .abiversion 2
        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl rot
        .type   rot, @function
rot:
.LFB0:
        .cfi_startproc
        .localentry     rot,1
        rlwinm 3,3,0,2,0
        rldicl 3,3,0,32
        blr
        .long 0
        .byte 0,0,0,0,0,0,0,0
        .cfi_endproc
.LFE0:
        .size   rot,.-rot
        .ident  "GCC: (GNU) 14.0.1 20240219 (experimental) [remotes/origin/HEAD
r14-9074-gd70facd54a]"
        .section        .note.GNU-stack,"",@progbits

Reply via email to