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

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <h...@gcc.gnu.org>:

https://gcc.gnu.org/g:f3a5e75cb66dc96efca7d494fe6060746c88acb1

commit r13-1415-gf3a5e75cb66dc96efca7d494fe6060746c88acb1
Author: H.J. Lu <hjl.to...@gmail.com>
Date:   Fri Jun 17 17:02:05 2022 -0700

    x86: Support 2/4/8 byte constant vector stores

    1. Add a predicate for constant vectors which can be converted to integer
    constants suitable for constant integer stores.  For a 8-byte constant
    vector, the converted 64-bit integer must be valid for store with 64-bit
    immediate, which is a 64-bit integer sign-extended from a 32-bit integer.
    2. Add a new pattern to allow 2-byte, 4-byte and 8-byte constant vector
    stores, like

    (set (mem:V2HI (reg:DI 84))
         (const_vector:V2HI [(const_int 0 [0]) (const_int 1 [0x1])]))

    3. After reload, convert constant vector stores to constant integer
    stores, like

    (set (mem:SI (reg:DI 5 di [84]))
         (const_int 65536 [0x10000]))

    For

    void
    foo (short * c)
    {
      c[0] = 0;
      c[1] = 1;
    }

    it generates

            movl    $65536, (%rdi)

    instead of

            movl    .LC0(%rip), %eax
            movl    %eax, (%rdi)

    gcc/

            PR target/106022
            * config/i386/i386-protos.h (ix86_convert_const_vector_to_integer):
            New.
            * config/i386/i386.cc (ix86_convert_const_vector_to_integer):
            New.
            * config/i386/mmx.md (V_16_32_64): New.
            (*mov<mode>_imm): New patterns for stores with 16-bit, 32-bit
            and 64-bit constant vector.
            * config/i386/predicates.md (x86_64_const_vector_operand): New.

    gcc/testsuite/

            PR target/106022
            * gcc.target/i386/pr106022-1.c: New test.
            * gcc.target/i386/pr106022-2.c: Likewise.
            * gcc.target/i386/pr106022-3.c: Likewise.
            * gcc.target/i386/pr106022-4.c: Likewise.

Reply via email to