view test/ps2code.c @ 935:7672a37e7545 default tip

Raspbery PI ARM support begin
author kono
date Sat, 24 Dec 2016 03:02:57 +0000
parents c2c709727221
children
line wrap: on
line source

#define __environment _CbC_environment
#define __return _CbC_return

#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("#0021:%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("#0036:offset %d\n",((char*)a) - ((char*)(&m)));
   printf("#0037:%d %d %d\n",mod16(m),mod16(n),mod16(o));
   goto align16(i-1,m,n);
}

__code (*exit0)(int,void*);
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("#0052:offset %d\n",((char*)a) - ((char*)(&m)));
   printf("#0053:%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 */