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

            Bug ID: 117863
           Summary: Missing pcmpeq splitters
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: x86-64

$ cat vector_eq-2.c
/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
/* { dg-additional-options "-O2 -march=x86-64-v3" } */

typedef int v4si __attribute__((vector_size(16)));

v4si __RTL (startwith ("vregs")) foo (void)
{
(function "foo"
  (insn-chain
    (block 2
      (edge-from entry (flags "FALLTHRU"))
      (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK)
      (cnote 2 NOTE_INSN_FUNCTION_BEG)
      (cinsn 3 (set (reg:V4SI <0>) (const_vector:V4SI [(const_int -1)
(const_int -1) (const_int -1) (const_int -1)])))
      (cinsn 4 (set (reg:V4SI <1>) (const_vector:V4SI [(const_int -1)
(const_int -1) (const_int -1) (const_int -1)])))
      (cinsn 5 (set (reg:V4SI <2>)
                    (eq:V4SI (reg:V4SI <0>) (reg:V4SI <1>))))
      (cinsn 6 (set (reg:V4SI <3>) (reg:V4SI <2>)))
      (cinsn 7 (set (reg:V4SI xmm0) (reg:V4SI <3>)))
      (edge-to exit (flags "FALLTHRU"))
    )
  )
 (crtl (return_rtx (reg/i:V4SI xmm0)))
)
}

/* { dg-final { scan-assembler-times "vpcmpeqd" 1 } } */
$ /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2 
-march=x86-64-v3 -S vector_eq-2.c
$ cat vector_eq-2.s
        .file   "vector_eq-2.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        vpcmpeqd        %xmm0, %xmm0, %xmm0
        vpcmpeqd        %xmm0, %xmm0, %xmm0
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 15.0.0 20241129 (experimental) [master
r15-5113-g858912fa675]"
        .section        .note.GNU-stack,"",@progbits
$ 

(insn 5 3 7 2 (set (reg:V4SI 100)
        (eq:V4SI (reg:V4SI 98)
            (reg:V4SI 98))) 7910 {*sse2_eqv4si3}
     (expr_list:REG_DEAD (reg:V4SI 98)
        (expr_list:REG_EQUAL (eq:V4SI (const_vector:V4SI [
                        (const_int -1 [0xffffffffffffffff]) repeated x4
                    ])
                (const_vector:V4SI [
                        (const_int -1 [0xffffffffffffffff]) repeated x4
                    ]))
            (nil))))

should be converted to

(insn 5 10 12 2 (set (reg:V4SI 100)
        (const_vector:V4SI [
                (const_int -1 [0xffffffffffffffff]) repeated x4
            ])) 2363 {movv4si_internal}
     (nil))

Reply via email to