/* >>68 さん。的確なアドバイスありがとうございます。>>68 さんの方法で書いてみました。*/
/* 種で初期化する関数付き。XorShift の SSE2 による高速化はあきらめるしかないのか! */
#include <stdio.h>
#include <time.h>
#include <emmintrin.h>
unsigned long xor128(void) {
static unsigned long x=123456789UL,y=362436069UL,z=521288629UL,w=88675123UL;
unsigned long t;t=(x^(x<<11));x=y;y=z;z=w;return(w=(w^(w>>19))^(t^(t>>8)));}

int idx=4; union { unsigned long v[4]; __m128i m; }
x={123456789,123456789,123456789,123456789},y={362436069,362436069,362436069,362436069},
z={521288629,521288629,521288629,521288629},w={ 88675123, 88675123, 88675123, 88675123};

void sxor128x4(unsigned long s)
{int i; for (idx=4,i=0;i<16;i++) x.v[i]=s=1812433253*(s^(s>>30))+i; }

unsigned long xor128x4(void) { __m128i t,r,s;
if (idx==4) { r=_mm_slli_epi32(x.m,11); t=_mm_xor_si128(x.m,r); x.m=y.m; y.m=z.m;
s=z.m=w.m; r=_mm_srli_epi32(s,19); s=_mm_xor_si128(s,r); r=_mm_srli_epi32(t,8);
t=_mm_xor_si128(t,r); s=_mm_xor_si128(s,t); w.m=s; idx=0; }
return(w.v[idx++]); }

void main(void){ long i,c;
for (i=0;i<9;i++) printf("%8lx %8lx %8lx %8lx %8lx\n",
xor128(),xor128x4(),xor128x4(),xor128x4(),xor128x4() );
for (sxor128x4(1),i=0;i<9;i++)
for (printf("\n"),c=0;c<4;c++) printf("%8lx ",xor128x4() );
for (c=clock(),i=0;i<100000000L;i++) xor128();
printf("\n(xor128():%lu msec), ",clock()-c );
for (c=clock(),i=0;i<100000000L;i++) xor128x4();
printf("(xor128x4():%lu msec)\n",clock()-c ); }