public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yyc1992 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/95790] Incorrect static target dispatch
Date: Sat, 20 Jun 2020 19:26:16 +0000	[thread overview]
Message-ID: <bug-95790-4-g7ArKmKC5l@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95790-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Yichao Yu <yyc1992 at gmail dot com> ---
And the assembly showing the correct dispatch is


        .file   "a.c"
        .text
        .p2align 4
        .type   _ZL3fooPKcj, @function
_ZL3fooPKcj:
.LFB0:
        .cfi_startproc
        movl    $1, %eax
        ret
        .cfi_endproc
.LFE0:
        .size   _ZL3fooPKcj, .-_ZL3fooPKcj
        .p2align 4
        .type   _ZL3fooPKcj.avx, @function
_ZL3fooPKcj.avx:
.LFB1:
        .cfi_startproc
        movl    $2, %eax
        ret
        .cfi_endproc
.LFE1:
        .size   _ZL3fooPKcj.avx, .-_ZL3fooPKcj.avx
        .p2align 4
        .type   _ZL3fooPKcj.avx512f, @function
_ZL3fooPKcj.avx512f:
.LFB2:
        .cfi_startproc
        movl    $3, %eax
        ret
        .cfi_endproc
.LFE2:
        .size   _ZL3fooPKcj.avx512f, .-_ZL3fooPKcj.avx512f
        .section        .text.unlikely,"ax",@progbits
.LCOLDB0:
        .text
.LHOTB0:
        .p2align 4
        .type   _ZL3fooPKcj.resolver, @function
_ZL3fooPKcj.resolver:
.LFB6:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        call    __cpu_indicator_init@PLT
        movq    __cpu_model@GOTPCREL(%rip), %rax
        movl    12(%rax), %eax
        testb   $-128, %ah
        je      .L8
        leaq    _ZL3fooPKcj.avx512f(%rip), %rax
.L7:
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
        .section        .text.unlikely
        .cfi_startproc
        .type   _ZL3fooPKcj.resolver.cold, @function
_ZL3fooPKcj.resolver.cold:
.LFSB6:
.L8:
        .cfi_def_cfa_offset 16
        testb   $2, %ah
        leaq    _ZL3fooPKcj.avx(%rip), %rdx
        leaq    _ZL3fooPKcj(%rip), %rax
        cmovne  %rdx, %rax
        jmp     .L7
        .cfi_endproc
.LFE6:
        .text
        .size   _ZL3fooPKcj.resolver, .-_ZL3fooPKcj.resolver
        .section        .text.unlikely
        .size   _ZL3fooPKcj.resolver.cold, .-_ZL3fooPKcj.resolver.cold
.LCOLDE0:
        .text
.LHOTE0:
        .type   _Z11_ZL3fooPKcjPKcj, @gnu_indirect_function
        .set    _Z11_ZL3fooPKcjPKcj,_ZL3fooPKcj.resolver
        .p2align 4
        .globl  _Z3barv
        .type   _Z3barv, @function
_Z3barv:
.LFB3:
        .cfi_startproc
        pushq   %r12
        .cfi_def_cfa_offset 16
        .cfi_offset 12, -16
        xorl    %r12d, %r12d
        pushq   %rbp
        .cfi_def_cfa_offset 24
        .cfi_offset 6, -24
        pushq   %rbx
        .cfi_def_cfa_offset 32
        .cfi_offset 3, -32
        subq    $4112, %rsp
        .cfi_def_cfa_offset 4144
        movq    %fs:40, %rax
        movq    %rax, 4104(%rsp)
        xorl    %eax, %eax
        movq    %rsp, %rbx
        leaq    4096(%rsp), %rbp
        .p2align 4,,10
        .p2align 3
.L12:
        movq    %rbx, %rdi
        movl    $1, %esi
        addq    $1, %rbx
        call    _Z11_ZL3fooPKcjPKcj@PLT
        addl    %eax, %r12d
        cmpq    %rbp, %rbx
        jne     .L12
        movq    4104(%rsp), %rax
        subq    %fs:40, %rax
        jne     .L16
        addq    $4112, %rsp
        .cfi_remember_state
        .cfi_def_cfa_offset 32
        movl    %r12d, %eax
        popq    %rbx
        .cfi_def_cfa_offset 24
        popq    %rbp
        .cfi_def_cfa_offset 16
        popq    %r12
        .cfi_def_cfa_offset 8
        ret
.L16:
        .cfi_restore_state
        call    __stack_chk_fail@PLT
        .cfi_endproc
.LFE3:
        .size   _Z3barv, .-_Z3barv
        .p2align 4
        .globl  _Z3barv.avx
        .type   _Z3barv.avx, @function
_Z3barv.avx:
.LFB4:
        .cfi_startproc
        pushq   %r12
        .cfi_def_cfa_offset 16
        .cfi_offset 12, -16
        xorl    %r12d, %r12d
        pushq   %rbp
        .cfi_def_cfa_offset 24
        .cfi_offset 6, -24
        pushq   %rbx
        .cfi_def_cfa_offset 32
        .cfi_offset 3, -32
        subq    $4112, %rsp
        .cfi_def_cfa_offset 4144
        movq    %fs:40, %rax
        movq    %rax, 4104(%rsp)
        xorl    %eax, %eax
        movq    %rsp, %rbx
        leaq    4096(%rsp), %rbp
        .p2align 4,,10
        .p2align 3
.L18:
        movq    %rbx, %rdi
        movl    $1, %esi
        addq    $1, %rbx
        call    _Z11_ZL3fooPKcjPKcj@PLT
        addl    %eax, %r12d
        cmpq    %rbp, %rbx
        jne     .L18
        movq    4104(%rsp), %rax
        subq    %fs:40, %rax
        jne     .L22
        addq    $4112, %rsp
        .cfi_remember_state
        .cfi_def_cfa_offset 32
        movl    %r12d, %eax
        popq    %rbx
        .cfi_def_cfa_offset 24
        popq    %rbp
        .cfi_def_cfa_offset 16
        popq    %r12
        .cfi_def_cfa_offset 8
        ret
.L22:
        .cfi_restore_state
        call    __stack_chk_fail@PLT
        .cfi_endproc
.LFE4:
        .size   _Z3barv.avx, .-_Z3barv.avx
        .ident  "GCC: (GNU) 10.1.0"
        .section        .note.GNU-stack,"",@progbits

  parent reply	other threads:[~2020-06-20 19:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 19:08 [Bug ipa/95790] New: " yyc1992 at gmail dot com
2020-06-20 19:22 ` [Bug ipa/95790] " hjl.tools at gmail dot com
2020-06-20 19:25 ` yyc1992 at gmail dot com
2020-06-20 19:26 ` yyc1992 at gmail dot com [this message]
2020-06-20 20:33 ` hjl.tools at gmail dot com
2020-06-20 20:59 ` yyc1992 at gmail dot com
2020-06-20 22:36 ` hjl.tools at gmail dot com
2020-06-21  0:02 ` yyc1992 at gmail dot com
2020-06-21  0:12 ` yyc1992 at gmail dot com
2020-06-22  8:12 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95790-4-g7ArKmKC5l@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).