view test/ps2code.c @ 691:25115b50d033

*** empty log message ***
author kono
date Wed, 10 Oct 2007 17:58:15 +0900
parents fe23fe842b82
children 3f1f6c0610c1
line wrap: on
line source

#ifndef INLINE
#define INLINE
#endif

int printf(const char *,...);
void bzero(void *b, unsigned int len);



typedef float        ps2_vu0_fmatrix[4][4] __attribute__((aligned (16)));
typedef ps2_vu0_fmatrix FMATRIX;

typedef float        ps2_vu0_fmatrix1[4][4];
typedef ps2_vu0_fmatrix1 FMATRIX1;


void  ps2_vu0_unit_matrix(ps2_vu0_fmatrix m)
{
    printf("%g\n",m[1][1]);
    m[1][1] = -0.5;
}


#define mod16(a) (((int)(&a))%16)

__code
align16(int i, FMATRIX a, FMATRIX b) {
   FMATRIX m;
   FMATRIX n;
   int k = i;
   FMATRIX o;
   ps2_vu0_unit_matrix(a);
   if (i==0) goto align16_1(2,a,b);
   printf("offset %d\n",((char*)a) - ((char*)(&m)));
   printf("%d %d %d\n",mod16(m),mod16(n),mod16(o));
   goto align16(i-1,m,n);
}

__code (*exit0)(int);
void *env;

__code
align16_1(int i, FMATRIX1 a, FMATRIX1 b) {
   FMATRIX1 m;
   FMATRIX1 n;
   int k = i;
   FMATRIX1 o;
   ps2_vu0_unit_matrix(a);
   if (i==0) goto exit0(0),env;
   printf("offset %d\n",((char*)a) - ((char*)(&m)));
   printf("%d %d %d\n",mod16(m),mod16(n),mod16(o));
   goto align16_1(i-1,m,n);
}


int
main(int ac, char *av[])
{
    FMATRIX m;

    m[1][1] = 0.5;
    exit0 = return;
    env = environment;
    goto align16(2,m,m);
}


/* end */