The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: NightWare on December 26, 2007, 10:54:30 PM

Title: Shuffle
Post by: NightWare on December 26, 2007, 10:54:30 PM
shuffle are quite painfull instructions to read, or set... because of the 256 possibilities. even when you fully understand how it works, there is always possible mistakes/errors when reading and setting... so here a tiny tool to clearly show you the real move of the dwords/words inside the simd registers (note : for memory operand the the dwords/words are reversed, of course) this tool is for shufps and pshufd for xmmx registers, or pshufw in the case of mmx registers

the app and the source are in french, so what ?

[attachment deleted by admin]
Title: Re: Shuffle
Post by: Adamanteus on December 27, 2007, 08:02:08 PM
 Here's russian resource file attached.
Could you explain basically, for what is need program - by one sentence or URL, appreciated ?

[attachment deleted by admin]
Title: Re: Shuffle
Post by: NightWare on December 27, 2007, 11:48:16 PM
shuffle are simd instructions that allow you to define/select/swap 32bits/16bits values, it's usefull for parallel opérations, but there is 256 possible combination...

there is instructions that allow some of the combination, without argument (movlhps, movhlps, etc... but since there is no argument it's not flexible... shuffle is flexible (just a bit slower) but you need to know the needed argument for the desired result... shuffle is flexible, yes, but there is also some limitations
the dwords/words can't be totally placed where you want... the lowest half register (right) come from the first used register and the higher half register (left) come from the second register

the 256 possibilities are in fact 4*4*4*4 where 4 is in fact a value form 0 to 3, coresponding to the number of the dword/word INSIDE the simd register.

this tool show you the result you will obtain in a xmmX (for ex: 0) register when using with xmmX (0) and another xmmX register (0 to 8, or 15 if you code in 64 bits).

it's usefull when you need to understand a simd code (especially if you are new in the wonderfull simd world), it clearly show the movments. when you are not new in the simd world, it's also a good tool verify you use the correct argument

:eek i don't know if it's the answer/explanation you expected, but it's mine...
Title: Re: Shuffle
Post by: Adamanteus on December 28, 2007, 12:24:39 PM
 Thanks, I'll be joining this simd world.   :wink
Title: Re: Shuffle
Post by: GregL on January 02, 2008, 10:29:46 PM
NightWare,

Thanks, that could come in handy. The Intel documentation for shufps is confusing, with your program it all makes sense.  :U



Title: Re: Shuffle
Post by: Alloy on January 03, 2008, 01:57:03 AM
The AMD documentation was clearer to me.  http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/26568.pdf

Try this
http://www.masm32.com/board/index.php?topic=782.0
too.
Title: Re: Shuffle
Post by: NightWare on January 03, 2008, 11:23:45 PM
Quote from: Alloy on January 03, 2008, 01:57:03 AM
The AMD documentation was clearer to me.  http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/26568.pdf

lol, this one confuse me with the crossing lines  :bg