[Bug middle-end/99339] Poor codegen with simple varargs

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 2 12:46:01 GMT 2021


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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, clang manages to produce the following, which shows the situation could be
worse ;)

test_va:                                # @test_va
        .cfi_startproc
# %bb.0:
        subq    $88, %rsp
        .cfi_def_cfa_offset 96
        movl    %eax, %r10d
        movl    %edi, %eax
        testb   %r10b, %r10b
        je      .LBB0_2
# %bb.1:
        movaps  %xmm0, -48(%rsp)
        movaps  %xmm1, -32(%rsp)
        movaps  %xmm2, -16(%rsp)
        movaps  %xmm3, (%rsp)
        movaps  %xmm4, 16(%rsp)
        movaps  %xmm5, 32(%rsp)
        movaps  %xmm6, 48(%rsp)
        movaps  %xmm7, 64(%rsp)
.LBB0_2:
        movq    %rsi, -88(%rsp)
        movq    %rdx, -80(%rsp)
        movq    %rcx, -72(%rsp)
        movq    %r8, -64(%rsp)
        movq    %r9, -56(%rsp)
        leaq    -96(%rsp), %rcx
        movq    %rcx, -112(%rsp)
        leaq    96(%rsp), %rcx
        movq    %rcx, -120(%rsp)
        movabsq $206158430216, %rcx     # imm = 0x3000000008
        movq    %rcx, -128(%rsp)
        movl    $8, %edx
        cmpq    $40, %rdx
        ja      .LBB0_4
# %bb.3:
        movl    $8, %ecx
        addq    -112(%rsp), %rcx
        addl    $8, %edx
        movl    %edx, -128(%rsp)
        jmp     .LBB0_5
.LBB0_4:
        movq    -120(%rsp), %rcx
        leaq    8(%rcx), %rdx
        movq    %rdx, -120(%rsp)
.LBB0_5:
        addl    (%rcx), %eax
        addq    $88, %rsp
        .cfi_def_cfa_offset 8
        retq


More information about the Gcc-bugs mailing list