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

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
Hm, patched compiler produces quite unoptimal code:

        movl    .LC0, %esi
        movl    .LC0+4, %ebx
        movl    .LC0+8, %ecx
        movl    .LC0+12, %edx
        movl    48(%esp), %eax
        movl    %esi, 16(%esp)
        movl    %ebx, 20(%esp)
        movl    %ecx, 24(%esp)
        movl    %edx, 28(%esp)
   <--- **asm is here**
        movl    16(%esp), %esi
        movl    20(%esp), %ebx
        movl    24(%esp), %ecx
        movl    28(%esp), %edx
        movl    %esi, (%esp)  <-- dead store
        movl    %esi, (%eax)
        movl    %ebx, 4(%esp)  <-- dead store
        movl    %ecx, 8(%esp)  <-- dead store
        movl    %edx, 12(%esp)  <-- dead store
        movl    %ebx, 4(%eax)
        movl    %ecx, 8(%eax)
        movl    %edx, 12(%eax)

.LC0:
        .long   10
        .long   0
        .long   0
        .long   809369600

.reload pass creates:

   25: [sp:SI]=0xa
   26: [sp:SI+0x4]=0
   27: [sp:SI+0x8]=0
   28: [sp:SI+0xc]=0x303e0000  <--- the constant is already on stack
   31: si:SI=[`*.LC0']
   48: [sp:SI+0x10]=si:SI
   32: bx:SI=[const(`*.LC0'+0x4)]
   47: [sp:SI+0x14]=bx:SI
   33: cx:SI=[const(`*.LC0'+0x8)]
   46: [sp:SI+0x18]=cx:SI
   34: dx:SI=[const(`*.LC0'+0xc)]
   45: [sp:SI+0x1c]=dx:SI      <--- another copy of the constant on stack
   11: {[sp:SI+0x10]=asm_operands;clobber flags:CC;}
   44: si:SI=[sp:SI+0x10]
   36: [sp:SI]=si:SI
   43: bx:SI=[sp:SI+0x14]
   37: [sp:SI+0x4]=bx:SI
   42: cx:SI=[sp:SI+0x18]
   38: [sp:SI+0x8]=cx:SI
   41: dx:SI=[sp:SI+0x1c]
   39: [sp:SI+0xc]=dx:SI       <--- copies from temporary to the original loc
    6: si:SI=[sp:SI]
    7: bx:SI=[sp:SI+0x4]
    8: cx:SI=[sp:SI+0x8]
    9: dx:SI=[sp:SI+0xc]       <--- and from the original loc ...
   12: [ax:SI]=si:SI
   13: [ax:SI+0x4]=bx:SI
   14: [ax:SI+0x8]=cx:SI
   15: [ax:SI+0xc]=dx:SI       <--- ... to the result ptr
   20: use ax:SI

Reply via email to