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

            Bug ID: 117310
           Summary: Unnecessary zero-extension for tailcall
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com
  Target Milestone: ---

[hjl@gnu-tgl-3 tailcall-1]$ cat x.c
extern int baz (char c1);

int
foo (char c1)
{
  return baz (c1);
}
[hjl@gnu-tgl-3 tailcall-1]$ make CC=gcc
gcc -O2  -S x.c
[hjl@gnu-tgl-3 tailcall-1]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        movsbl  %dil, %edi  <<<< This isn't needed.
        jmp     baz
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 14.2.1 20240912 (Red Hat 14.2.1-3)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-3 tailcall-1]$ 

movsbl isn't needed regardless if baz is compiled by GCC nor non-GCC.

Reply via email to