Mercurial > hg > CbC > old > device
annotate test/ps2code.c @ 751:c921670e2ce8
i64 continue... 64bit register
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 14 Nov 2010 04:56:02 +0900 |
parents | c2c709727221 |
children |
rev | line source |
---|---|
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
647
diff
changeset
|
1 #define __environment _CbC_environment |
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
647
diff
changeset
|
2 #define __return _CbC_return |
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
647
diff
changeset
|
3 |
647 | 4 #ifndef INLINE |
5 #define INLINE | |
6 #endif | |
7 | |
8 int printf(const char *,...); | |
9 void bzero(void *b, unsigned int len); | |
10 | |
11 | |
12 | |
13 typedef float ps2_vu0_fmatrix[4][4] __attribute__((aligned (16))); | |
14 typedef ps2_vu0_fmatrix FMATRIX; | |
15 | |
16 typedef float ps2_vu0_fmatrix1[4][4]; | |
17 typedef ps2_vu0_fmatrix1 FMATRIX1; | |
18 | |
19 | |
20 void ps2_vu0_unit_matrix(ps2_vu0_fmatrix m) | |
21 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
22 printf("#0021:%g\n",m[1][1]); |
647 | 23 m[1][1] = -0.5; |
24 } | |
25 | |
26 | |
27 #define mod16(a) (((int)(&a))%16) | |
28 | |
29 __code | |
30 align16(int i, FMATRIX a, FMATRIX b) { | |
31 FMATRIX m; | |
32 FMATRIX n; | |
33 int k = i; | |
34 FMATRIX o; | |
35 ps2_vu0_unit_matrix(a); | |
36 if (i==0) goto align16_1(2,a,b); | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
37 printf("#0036:offset %d\n",((char*)a) - ((char*)(&m))); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
38 printf("#0037:%d %d %d\n",mod16(m),mod16(n),mod16(o)); |
647 | 39 goto align16(i-1,m,n); |
40 } | |
41 | |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
647
diff
changeset
|
42 __code (*exit0)(int,void*); |
647 | 43 void *env; |
44 | |
45 __code | |
46 align16_1(int i, FMATRIX1 a, FMATRIX1 b) { | |
47 FMATRIX1 m; | |
48 FMATRIX1 n; | |
49 int k = i; | |
50 FMATRIX1 o; | |
51 ps2_vu0_unit_matrix(a); | |
725
3f1f6c0610c1
goto with enviornment syntax changed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
647
diff
changeset
|
52 if (i==0) goto exit0(0,env); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
53 printf("#0052:offset %d\n",((char*)a) - ((char*)(&m))); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
725
diff
changeset
|
54 printf("#0053:%d %d %d\n",mod16(m),mod16(n),mod16(o)); |
647 | 55 goto align16_1(i-1,m,n); |
56 } | |
57 | |
58 | |
59 int | |
60 main(int ac, char *av[]) | |
61 { | |
62 FMATRIX m; | |
63 | |
64 m[1][1] = 0.5; | |
65 exit0 = return; | |
66 env = environment; | |
67 goto align16(2,m,m); | |
68 } | |
69 | |
70 | |
71 /* end */ |