This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, x86] Generate vector -1 with pcmpeq


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@apple.com>


* 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.


Attachment: patch.fsf.4283414.txt
Description: Text document


Evan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]