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

            Bug ID: 127885
           Summary: r17-4622-gbbf9808d787eac disabled vectorizer
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: rguenther at suse dot de
  Target Milestone: ---
            Target: x86-64

Created attachment 65833
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65833&action=edit
A testcase

When compiled with -O2 -march=x86-64-v4, r17-4622-gbbf9808d787eac disabled
vectorizer. Before:

        .globl  _Z3foov
        .type   _Z3foov, @function
_Z3foov:
.LFB0:
        .cfi_startproc
        movq    foo_ptr(%rip), %rcx
        vpcmpeqd        %xmm3, %xmm3, %xmm3
        movabsq $47244640257, %rdx
        vpsrld  $31, %xmm3, %xmm3
        vmovdqu (%rcx), %ymm2
        vmovdqu (%rcx), %xmm1
        movq    24(%rcx), %rax
        vpermq  $0, %ymm2, %ymm0
        vpermilpd       $0, %xmm1, %xmm1
        vmovd   %xmm2, x_param_align_loop_iterations(%rip)
        vpsrlvq .LC0(%rip), %ymm0, %ymm2
        movl    %eax, x_param_phiopt_factor_max_stmts_live(%rip)
        vpsrlvq .LC2(%rip), %xmm1, %xmm1
        vpsrlvq .LC4(%rip), %ymm0, %ymm0
        vpmovqd %ymm2, %xmm2
        vpandd  %xmm3, %xmm2, %xmm2
        vpmovqd %xmm1, %xmm1
        vpmovqd %ymm0, %xmm0
        vmovdqu %xmm2, foo_opts_set(%rip)
        vmovq   %rdx, %xmm2
        vpandd  %xmm3, %xmm0, %xmm0
        vmovdqu %xmm0, foo_opts_set+28(%rip)
        vpand   %xmm1, %xmm2, %xmm1
        vmovq   %xmm1, foo_opts_set+16(%rip)
        vzeroupper
        ret
        .cfi_endproc
.LFE0:
        .size   _Z3foov, .-_Z3foov
        .section        .rodata.cst32,"aM",@progbits,32
        .align 32
.LC0:
        .quad   1
        .quad   1
        .quad   1
        .quad   2
        .section        .rodata.cst16,"aM",@progbits,16
        .align 16
.LC2:
        .quad   2
        .quad   3
        .section        .rodata.cst32
        .align 32
.LC4:
        .quad   3
        .quad   4
        .quad   5
        .quad   6

After:

_Z3foov:
.LFB0:
        .cfi_startproc
        movq    foo_ptr(%rip), %rcx
        movq    (%rcx), %rax
        movq    %rax, %rdx
        movl    %eax, x_param_align_loop_iterations(%rip)
        shrq    $1, %rdx
        andl    $1, %edx
        movl    %edx, foo_opts_set+8(%rip)
        movl    %edx, foo_opts_set+4(%rip)
        movl    %edx, foo_opts_set(%rip)
        movq    %rax, %rdx
        shrq    $2, %rdx
        andl    $1, %edx
        movl    %edx, foo_opts_set+16(%rip)
        movl    %edx, foo_opts_set+12(%rip)
        movq    %rax, %rdx
        shrq    $3, %rdx
        movl    %edx, %esi
        andl    $1, %edx
        movl    %edx, foo_opts_set+28(%rip)
        movq    %rax, %rdx
        andl    $11, %esi
        shrq    $4, %rdx
        movl    %esi, foo_opts_set+20(%rip)
        andl    $1, %edx
        movl    %edx, foo_opts_set+32(%rip)
        movq    %rax, %rdx
        shrq    $6, %rax
        andl    $1, %eax
        shrq    $5, %rdx
        movl    %eax, foo_opts_set+40(%rip)
        movq    24(%rcx), %rax
        andl    $1, %edx
        movl    %edx, foo_opts_set+36(%rip)
        movl    %eax, x_param_phiopt_factor_max_stmts_live(%rip)
        ret
        .cfi_endproc
.LFE0:
        .size   _Z3foov, .-_Z3foov

Reply via email to