gcc-patches@gcc.gnu.org
[Top] [All Lists]

Re: [PATCH, x86] Generate vector -1 with pcmpeq

Subject: Re: [PATCH, x86] Generate vector -1 with pcmpeq
From: Evan Cheng
Date: Tue, 1 Nov 2005 11:49:02 -0800
Ping?

Evan

On Oct 28, 2005, at 1:10 PM, Evan Cheng wrote:

Hi,

This patch allows vector constant -1 be generated with a pcmpeq instruction instead of a load.

For example:

__m128i set1_32bit() {
        return _mm_set1_epi32(-1);
}

    .size    set1_16bit, .-set1_16bit
.globl set1_32bit
    .type    set1_32bit, @function
set1_32bit:
    pushl    %ebp
    movl    %esp, %ebp
    pcmpeqw    %xmm0, %xmm0
    popl    %ebp
    ret


2005-10-28  Evan Cheng  <evan.cheng@xxxxxxxxx>

    * config/i386/i386-protos.h (ix86_const_vector_all_ones_operand)
    Declare
* config/i386/i386.c (ix86_const_vector_all_ones_operand) New function. (standard_sse_constant_p) Return true for constant 0 or vector constant
    all one's.
    (standard_sse_constant_opcode) New function to return the opcode
    associated with standard_sse_constant_p.
(ix86_expand_vector_move) Also check for vector constant all one's. * config/i386/predicates.md (vector_all_ones_operand) True if vector
    constant all one's.
    (vector_move_operand) True if vector_all_ones_operand is true.
    * config/i386/sse.md (*mov<mode>_internal) Use
    standard_sse_constant_opcode.
    (*movv4sf_internal) Use standard_sse_constant_opcode.
    (*movv2df_internal) Use standard_sse_constant_opcode.
(*vec_setv4sf_0) Added condition ! ix86_const_vector_all_ones_operand. (sse2_loadlpd) Added condition ! ix86_const_vector_all_ones_operand. (*vec_concatv2df) Added condition ! ix86_const_vector_all_ones_operand. (*vec_concatv2di) Added condition ! ix86_const_vector_all_ones_operand.


<patch.fsf.4283414.txt>

Evan

<Prev in Thread] Current Thread [Next in Thread>