title: How to store numbers from a XMM register into a char array within an asm loop -
body: <p>I have an xmm register holding four 32bit numbers within it.</p>
  
  <p><code>XMM4 = 00000035000000350000003500000035</code></p>
  
  <p>I have a loop which calculates these numbers over and over again and I then need to store them in an array somehow. How can i use asm to store each individual number from the XMM register, on each iteration of the loop?</p>
  
  <p>Edit:</p>
  
  <p>I have tried creating a char array outside of my __asm block like so: <code>char numbers[20];</code>
  and then I've tried to move my registery values into it using <code>movdqa [numbers], xmm4</code>. This works for the first iteration of the loop, but I have no idea how to increment the index of the array on sequential iterations.</p>
  
  <p>Edit2: Here is my code</p>
  
  <pre><code>    __m128i stuff = _mm_setr_epi32 ( 87, 137, 202, 222 );
  
      __m128i zeros = _mm_setr_epi32 ( 0x0, 0x0, 0x0, 0x0 );
  
      __m128i fives = _mm_setr_epi32 ( 0x5, 0x5, 0x5, 0x5 );
  
      __m128i fortyEights = _mm_setr_epi32 ( 0x30, 0x30,0x30, 0x30 );
  
      __m128i magicNumber = _mm_setr_epi32 ( 0x66666667, 0x66666667, 0x66666667, 0x66666667 );
  
          __asm { 
                  movdqa      xmm0, stuff         //Move data into xmm0
                  movdqa      xmm1, magicNumber   //Move magic numbers into xmm1
                  movdqa      xmm2, xmm0          //Copy data into xmm2
                  vpcmpeqb    xmm2, xmm0, xmm2    //Compare data against zeros
                  je          bail            //if data is all zeros then bail
  
      nextdigit:  pmulhw      xmm2, xmm1          //Multiply data in xmm2 by the magic numbers in xmm1
                  psrad       xmm2, 2             //Divide [wip]data by 4 
                  movdqa      xmm3, fives         //Copy the fives into xmm3
                  pmullw      xmm3, xmm2          //Multiply [wip]data in xmm2 by the fives in xmm3
                  paddd       xmm3, xmm3          //Multiply the [wip]data by 2
                  movdqa      xmm4, xmm0          //Copy the original into xmm4
                  psubd       xmm4, xmm3          //Subtract the [wip]data from the original data
                  paddd       xmm4, fortyEights   //Add 48 to the [wip]data in xmm4 in order to get the ascii value
  
      // HERE IS WHERE I WANT TO SAVE THE VALUES TO AN ARRAY
  
                  comiss      xmm0, zeros
                  jne         nextdigit
  bail:
                  mov         eax, 0
      }
  </code></pre>