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]

Re: [PATCH, i386]: Vectorize copysign for x86


On Wed, Jul 15, 2009 at 05:53:54PM +0200, Uros Bizjak wrote:
> On 07/15/2009 05:45 PM, Richard Guenther wrote:
> >Generating these kind of constants may be smaller and faster if
> >we use some arithmetic tricks.  Do we have some generic routine
> >that could be used to materialize special constants?
> 
> We can generate {0, 0, 0, 0} using pxor and {-1, -1, -1, -1} using 
> pcmpeqd, see standard_sse_constant_opcode and friends in 
> config/i386/i386.c.  Although { 0x8000, 0x8000, 0x8000, 0x8000 } looks 
> quite promising, I don't know of any simple way to directly materialize 
> these kinds of constants in the register.

You can just do:

  pcmpeqd xmm, xmm
  pslld xmm, 31

(assuming you meant 0x80000000 in the vector above) can't you?

-Nathan


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