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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-march=znver[456] doesn't   |-Os may not generate the
                   |honor -Os                   |shortest code sequences

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
It isn't limited to -march=znver4:

[hjl@gnu-zen4-1 pr126980]$ cat y.c 
int
func (int i)
{
  int a[] =
    { 0, 1, 2, 3, 4, 5, 6, 7,
      8, 9, 10, 11, 12, 13, 14, 15 };
  return a[i];
}
[hjl@gnu-zen4-1 pr126980]$ make CC=gcc y.s
gcc -Os -march=x86-64-v4 -S y.c
[hjl@gnu-zen4-1 pr126980]$ cat y.s
        .file   "y.c"
        .text
        .globl  func
        .type   func, @function
func:
.LFB0:
        .cfi_startproc
        movl    $1, %eax
        movslq  %edi, %rdi
        salq    $32, %rax
        movq    %rax, -64(%rsp)
        movabsq $12884901890, %rax
        movq    %rax, -56(%rsp)
        movabsq $21474836484, %rax
        movq    %rax, -48(%rsp)
        movabsq $30064771078, %rax
        movq    %rax, -40(%rsp)
        movabsq $38654705672, %rax
        movq    %rax, -32(%rsp)
        movabsq $47244640266, %rax
        movq    %rax, -24(%rsp)
        movabsq $55834574860, %rax
        movq    %rax, -16(%rsp)
        movabsq $64424509454, %rax
        movq    %rax, -8(%rsp)
        movl    -64(%rsp,%rdi,4), %eax
        ret
        .cfi_endproc
.LFE0:
        .size   func, .-func
        .ident  "GCC: (GNU) 16.2.1 20260819 (Red Hat 16.2.1-2)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-zen4-1 pr126980]$

Reply via email to