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

--- Comment #13 from Qing Zhao <qing.zhao at oracle dot com> ---
I checked the same testing case on X86, SPARC in addition to aarch64, all have
the same issue:  (compile with gcc -O, the default is -m64)

***x86:
test1:
.LFB0:
        .cfi_startproc
        leal    1(%rdi), %eax
        movl    %eax, %edx
        movq    %rdx, d(%rip)
        ret
        .cfi_endproc
in the above, "movl  %eax, %edx" is the insn that can be eliminated.

***SPARC:
test1:
        sethi   %hi(d), %g1
        add     %o0, 1, %o0
        srl     %o0, 0, %o0
        jmp     %o7+8
         stx    %o0, [%g1+%lo(d)]

in the above, "srl  %o0, 0, %o0" is the insn that can be eliminated.

so, this seems a common issue on -m64 targets.

(NOTE, this issue does NOT exist on -m32 targets).

Reply via email to