SIMD programming

Programming, for all ages and all languages.
Locked
User avatar
samoz
Member
Member
Posts: 59
Joined: Sun Jun 01, 2008 1:16 pm

SIMD programming

Post by samoz »

Hey guys, I'm trying to use vectorization and the XMM processors to speed up my program, whose job is to multiply floating point numbers.

I understand how I can load bits 0-63 into bits 64-127 of my register. My problem is, how can I load two unique floats into bits 0-63? Can I load one float into 0-31, then bit shift it, then load another? If so, how would I do this?

Here is what I have so far:

Code: Select all

   movaps (%r13), %xmm1 # load A in xmm1
   shl $32, %xmm1 # shift A[0:31] to A[32:63]
   movaps (%r13), %xmm1
   movlhps %xmm1, %xmm1 # shift A[0:63] to A[64:127]
Hexciting: An open source hex editor for the command line.
https://sourceforge.net/projects/hexciting/
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: SIMD programming

Post by Combuster »

Try looking up MOVD and PSHUFD
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
samoz
Member
Member
Posts: 59
Joined: Sun Jun 01, 2008 1:16 pm

Re: SIMD programming

Post by samoz »

Will using MOVD allow me to load something into bits [0,31] and [32, 63] without overwriting the other set of bits? i.e. load something into [0,31] without overwriting [32, 63]?
Hexciting: An open source hex editor for the command line.
https://sourceforge.net/projects/hexciting/
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: SIMD programming

Post by Combuster »

RTFM, really
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Locked