47#if ((defined SSE)||(defined SSE2))
52}
vec_t __attribute__ ((aligned (16)));
59static int init=0,pr,prm,ir,jr,is,is_old,next[96];
66} x __attribute__ ((aligned (16)));
69 __asm__ __volatile__ ("movaps %2, %%xmm4 \n\t" \
70 "movaps %%xmm2, %%xmm3 \n\t" \
71 "subps %0, %%xmm4 \n\t" \
72 "movaps %%xmm1, %%xmm5 \n\t" \
73 "cmpps $0x6, %%xmm4, %%xmm2 \n\t" \
74 "andps %%xmm2, %%xmm5 \n\t" \
75 "subps %%xmm3, %%xmm4 \n\t" \
76 "andps %%xmm0, %%xmm2 \n\t" \
77 "addps %%xmm4, %%xmm5 \n\t" \
78 "movaps %%xmm5, %0 \n\t" \
79 "movaps %3, %%xmm6 \n\t" \
80 "movaps %%xmm2, %%xmm3 \n\t" \
81 "subps %1, %%xmm6 \n\t" \
82 "movaps %%xmm1, %%xmm7 \n\t" \
83 "cmpps $0x6, %%xmm6, %%xmm2 \n\t" \
84 "andps %%xmm2, %%xmm7 \n\t" \
85 "subps %%xmm3, %%xmm6 \n\t" \
86 "andps %%xmm0, %%xmm2 \n\t" \
87 "addps %%xmm6, %%xmm7 \n\t" \
102 printf(
"Error in subroutine rlxd_init\n");
103 printf(
"Bad choice of luxury level (should be 1 or 2)\n");
106 printf(
"Error in subroutine rlxd_init\n");
107 printf(
"Bad choice of seed (should be between 1 and 2^31-1)\n");
110 printf(
"Error in rlxd_get\n");
111 printf(
"Undefined state (ranlxd is not initialized\n");
114 printf(
"Error in rlxd_reset\n");
115 printf(
"Unexpected input data\n");
118 printf(
"Program aborted\n");
134 __asm__ __volatile__ (
"movaps %0, %%xmm0 \n\t"
135 "movaps %1, %%xmm1 \n\t"
154 __asm__ __volatile__ (
"movaps %%xmm2, %0"
170static void define_constants()
180 b=(float)(ldexp(1.0,-24));
198 int ibit,jbit,xbit[31];
218 if ((seed<=0)||(i!=0))
235 xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
243 x.num[4*k+i]=(float)(ldexp((
double)(
ix),-24));
279 printf(
"ranlxd works!");
301 base=(float)(ldexp(1.0,24));
305 state[k+1]=(
int)(base*x.num[k]);
307 state[97]=(int)(base*carry.
c1);
308 state[98]=(int)(base*carry.
c2);
309 state[99]=(int)(base*carry.
c3);
310 state[100]=(int)(base*carry.
c4);
330 if ((state[k+1]<0)||(state[k+1]>=167777216))
333 x.num[k]=(float)(ldexp((
double)(state[k+1]),-24));
336 if (((state[97]!=0)&&(state[97]!=1))||
337 ((state[98]!=0)&&(state[98]!=1))||
338 ((state[99]!=0)&&(state[99]!=1))||
339 ((state[100]!=0)&&(state[100]!=1)))
342 carry.
c1=(float)(ldexp((
double)(state[97]),-24));
343 carry.
c2=(float)(ldexp((
double)(state[98]),-24));
344 carry.
c3=(float)(ldexp((
double)(state[99]),-24));
345 carry.
c4=(float)(ldexp((
double)(state[100]),-24));
355 if (((pr!=202)&&(pr!=397))||
356 (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
363#define BASE 0x1000000
376static int init=0,pr,prm,ir,jr,is,is_old,next[96];
377static double one_bit;
387 d=(*pj).c1.c1-(*pi).c1.c1-carry.c1; \
388 (*pi).c2.c1+=(d<0); \
390 (*pi).c1.c1=d&MASK; \
391 d=(*pj).c1.c2-(*pi).c1.c2-carry.c2; \
392 (*pi).c2.c2+=(d<0); \
394 (*pi).c1.c2=d&MASK; \
395 d=(*pj).c1.c3-(*pi).c1.c3-carry.c3; \
396 (*pi).c2.c3+=(d<0); \
398 (*pi).c1.c3=d&MASK; \
399 d=(*pj).c1.c4-(*pi).c1.c4-carry.c4; \
400 (*pi).c2.c4+=(d<0); \
402 (*pi).c1.c4=d&MASK; \
403 d=(*pj).c2.c1-(*pi).c2.c1; \
406 (*pi).c2.c1=d&MASK; \
407 d=(*pj).c2.c2-(*pi).c2.c2; \
410 (*pi).c2.c2=d&MASK; \
411 d=(*pj).c2.c3-(*pi).c2.c3; \
414 (*pi).c2.c3=d&MASK; \
415 d=(*pj).c2.c4-(*pi).c2.c4; \
421static void error(
int no)
426 printf(
"Error in rlxd_init\n");
427 printf(
"Arithmetic on this machine is not suitable for ranlxd\n");
430 printf(
"Error in subroutine rlxd_init\n");
431 printf(
"Bad choice of luxury level (should be 1 or 2)\n");
434 printf(
"Error in subroutine rlxd_init\n");
435 printf(
"Bad choice of seed (should be between 1 and 2^31-1)\n");
438 printf(
"Error in rlxd_get\n");
439 printf(
"Undefined state (ranlxd is not initialized)\n");
442 printf(
"Error in rlxd_reset\n");
443 printf(
"Arithmetic on this machine is not suitable for ranlxd\n");
446 printf(
"Error in rlxd_reset\n");
447 printf(
"Unexpected input data\n");
450 printf(
"Program aborted\n");
488static void define_constants()
492 one_bit=ldexp(1.0,-24);
506 int ibit,jbit,xbit[31];
509 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
530 if ((seed<=0)||(i!=0))
547 xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
585 r[k]=one_bit*((double)(x.num[is+4])+one_bit*(double)(x.num[is]));
633 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
644 if ((state[k+1]<0)||(state[k+1]>=167777216))
650 if (((state[97]!=0)&&(state[97]!=1))||
651 ((state[98]!=0)&&(state[98]!=1))||
652 ((state[99]!=0)&&(state[99]!=1))||
653 ((state[100]!=0)&&(state[100]!=1)))
669 if (((pr!=202)&&(pr!=397))||
670 (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
void rlxd_get(int state[])
void rlxd_reset(int state[])
void rlxd_init(int level, int seed)
void ranlxd(double r[], int n)
double precision pisqo6 one