Mercurial > hg > CbC > old > device
annotate test/basic.c @ 935:7672a37e7545 default tip
Raspbery PI ARM support begin
author | kono |
---|---|
date | Sat, 24 Dec 2016 03:02:57 +0000 |
parents | c2c709727221 |
children |
rev | line source |
---|---|
467 | 1 int printf(const char *format, ...); |
2 | |
534 | 3 // #define INLINE inline |
4 #ifdef INLINE | |
5 #else | |
6 #define INLINE | |
7 #endif | |
8 | |
467 | 9 |
375 | 10 #define ARG_ADDRESS 0 |
11 | |
97 | 12 double ggg = 0.134; |
13 float fff = 0.0; | |
14 | |
15 extern double eggg; | |
16 double eggg = 0.134; | |
17 extern float efff; | |
18 float efff = 0.1345; | |
19 | |
20 double ggg0; | |
21 float fff0; | |
22 | |
517 | 23 char *memchar = "memory string\n"; |
24 char arraychar[] = "array string\n"; | |
25 | |
97 | 26 #if 0 |
27 extern double reggg; | |
28 extern float refff; | |
29 #endif | |
89 | 30 |
534 | 31 INLINE |
496 | 32 int |
89 | 33 print(double d) |
34 { | |
35 float f; | |
36 int *dd; | |
37 | |
97 | 38 #if 0 |
39 f = refff; | |
40 f = reggg; | |
41 #endif | |
42 | |
89 | 43 f = d; |
44 | |
45 dd = (int*) &d; | |
542 | 46 printf("#0045:d %g\n",d); |
47 printf("#0046:dx %08x %08x\n",*(dd),*(dd+1)); | |
89 | 48 |
49 dd = (int*) &f; | |
542 | 50 printf("#0049:f %g\n",f); |
51 printf("#0050:dx %08x \n",*(dd)); | |
488 | 52 return 1; |
89 | 53 } |
54 | |
534 | 55 INLINE |
89 | 56 void |
57 tmp () { | |
58 char c; | |
59 int i; | |
60 c=-1; | |
61 i=c; | |
542 | 62 printf("#0061:%d %d %d\n",!i,~i,-i); |
63 printf("#0062:%d\n",i); | |
89 | 64 } |
65 | |
534 | 66 INLINE |
96 | 67 int |
68 g( | |
69 int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8 | |
70 ) | |
71 { | |
542 | 72 printf("#0071:g: %d\n", |
96 | 73 a0+a1+a2+a3+a4+a5+a6+a7+a8 |
74 ); | |
75 return a8; | |
76 } | |
77 | |
534 | 78 INLINE |
103 | 79 int |
119 | 80 i50( |
81 int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10,int a11,int a12,int a13,int a14,int a15,int a16,int a17,int a18,int a19,int a20,int a21,int a22,int a23,int a24,int a25,int a26,int a27,int a28,int a29,int a30,int a31,int a32,int a33,int a34,int a35,int a36,int a37,int a38,int a39,int a40,int a41,int a42,int a43,int a44,int a45,int a46,int a47,int a48,int a49 | |
108 | 82 ) |
83 { | |
375 | 84 #if ARG_ADDRESS |
542 | 85 printf("#0084:i50: a0 %x a49 %x\n",&a0,&a49); |
375 | 86 #endif |
542 | 87 printf("#0086:i50: %d\n", |
119 | 88 a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 |
108 | 89 ); |
90 return a8; | |
91 } | |
92 | |
534 | 93 INLINE |
119 | 94 float |
95 f50( | |
96 float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float a11,float a12,float a13,float a14,float a15,float a16,float a17,float a18,float a19,float a20,float a21,float a22,float a23,float a24,float a25,float a26,float a27,float a28,float a29,float a30,float a31,float a32,float a33,float a34,float a35,float a36,float a37,float a38,float a39,float a40,float a41,float a42,float a43,float a44,float a45,float a46,float a47,float a48,float a49 | |
97 ) | |
98 { | |
542 | 99 printf("#0098:f50: %g\n", |
119 | 100 a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 |
101 ); | |
102 return a8; | |
103 } | |
104 | |
534 | 105 INLINE |
119 | 106 double |
107 d50( | |
108 double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10,double a11,double a12,double a13,double a14,double a15,double a16,double a17,double a18,double a19,double a20,double a21,double a22,double a23,double a24,double a25,double a26,double a27,double a28,double a29,double a30,double a31,double a32,double a33,double a34,double a35,double a36,double a37,double a38,double a39,double a40,double a41,double a42,double a43,double a44,double a45,double a46,double a47,double a48,double a49 | |
109 ) | |
110 { | |
542 | 111 printf("#0110:d50: %g\n", |
119 | 112 a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 |
113 ); | |
114 return a8; | |
115 } | |
116 | |
676 | 117 INLINE |
118 long long | |
119 l50( | |
120 long long a0,long long a1,long long a2,long long a3,long long a4,long long a5,long long a6,long long a7,long long a8,long long a9,long long a10,long long a11,long long a12,long long a13,long long a14,long long a15,long long a16,long long a17,long long a18,long long a19,long long a20,long long a21,long long a22,long long a23,long long a24,long long a25,long long a26,long long a27,long long a28,long long a29,long long a30,long long a31,long long a32,long long a33,long long a34,long long a35,long long a36,long long a37,long long a38,long long a39,long long a40,long long a41,long long a42,long long a43,long long a44,long long a45,long long a46,long long a47,long long a48,long long a49 | |
121 ) | |
122 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
123 printf("#0122:l50: %lld\n", |
676 | 124 a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 |
125 ); | |
126 return a8; | |
127 } | |
119 | 128 |
534 | 129 INLINE |
108 | 130 int |
103 | 131 h( int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8) |
132 { | |
574 | 133 return g( a0,a1,a2,a3,a4,a5,a6,a7,a8); |
103 | 134 } |
135 | |
136 | |
534 | 137 INLINE |
96 | 138 double |
139 f( | |
140 double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8 | |
141 ) | |
142 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
143 printf("#0142:f: %g\n", |
96 | 144 a0+a1+a2+a3+a4+a5+a6+a7+a8 |
145 ); | |
146 return a8; | |
147 } | |
148 | |
534 | 149 INLINE |
89 | 150 void |
151 tmp1 () { | |
375 | 152 #if ARG_ADDRESS |
153 int a0; | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
154 printf("#0153:tmp1: a0 %x\n",&a0); |
375 | 155 #endif |
89 | 156 |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
157 printf("#0156:%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \n", |
119 | 158 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49 |
159 ); | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
160 printf("#0159:%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", |
119 | 161 0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 |
162 ); | |
163 | |
164 i50( | |
165 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49 | |
166 ); | |
167 f50( | |
168 0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 | |
169 ); | |
170 d50( | |
171 0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 | |
172 ); | |
173 | |
676 | 174 l50( |
175 0LL,1LL,2LL,3LL,4LL,5LL,6LL,7LL,8LL,9LL,10LL,11LL,12LL,13LL,14LL,15LL,16LL,17LL,18LL,19LL,20LL,21LL,22LL,23LL,24LL,25LL,26LL,27LL,28LL,29LL,30LL,31LL,32LL,33LL,34LL,35LL,36LL,37LL,38LL,39LL,40LL,41LL,42LL,43LL,44LL,45LL,46LL,47LL,48LL,49LL | |
176 ); | |
177 | |
103 | 178 h(0,1,2,3,4,5,6,7,1); |
96 | 179 g(g(0,1,2,3,4,5,6,7,0), |
180 g(0,1,2,3,4,5,6,7,1), | |
181 g(0,1,2,3,4,5,6,7,2), | |
182 g(0,1,2,3,4,5,6,7,3), | |
183 g(0,1,2,3,4,5,6,7,4), | |
184 g(0,1,2,3,4,5,6,7,5), | |
185 g(0,1,2,3,4,5,6,7,6), | |
186 g(0,1,2,3,4,5,6,7,6), | |
187 g(0,1,2,3,4,5,6,7,7)); | |
188 f(f(0,1,2,3,4,5,6,7,0), | |
189 f(0,1,2,3,4,5,6,7,1), | |
190 f(0,1,2,3,4,5,6,7,2), | |
191 f(0,1,2,3,4,5,6,7,3), | |
192 f(0,1,2,3,4,5,6,7,4), | |
193 f(0,1,2,3,4,5,6,7,5), | |
194 f(0,1,2,3,4,5,6,7,6), | |
195 f(0,1,2,3,4,5,6,7,6), | |
196 f(0,1,2,3,4,5,6,7,7)); | |
197 | |
89 | 198 } |
199 | |
534 | 200 INLINE |
496 | 201 void |
202 double_int() | |
203 { | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
204 printf("#0203:%d %f %f %f %f %f %f %f %f %f %f %f\n", |
496 | 205 1,0.1,.2,.3,.4,.5,.6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
206 printf("#0205:%d %d %f %f %f %f %f %f %f %f %f %f\n", |
496 | 207 1, 1,.2,.3,.4,.5,.6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
208 printf("#0207:%d %d %d %f %f %f %f %f %f %f %f %f\n", |
496 | 209 1, 1, 2,.3,.4,.5,.6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
210 printf("#0209:%d %d %d %d %f %f %f %f %f %f %f %f\n", |
496 | 211 1, 1, 2, 3,.4,.5,.6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
212 printf("#0211:%d %d %d %d %d %f %f %f %f %f %f %f\n", |
496 | 213 1, 1, 2, 3, 4,.5,.6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
214 printf("#0213:%d %d %d %d %d %d %f %f %f %f %f %f\n", |
496 | 215 1, 1, 2, 3, 4, 5,.6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
216 printf("#0215:%d %d %d %d %d %d %d %f %f %f %f %f\n", |
496 | 217 1, 1, 2, 3, 4, 5, 6,.7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
218 printf("#0217:%d %d %d %d %d %d %d %d %f %f %f %f\n", |
496 | 219 1, 1, 2, 3, 4, 5, 6, 7,.8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
220 printf("#0219:%d %d %d %d %d %d %d %d %d %f %f %f\n", |
496 | 221 1, 1, 2, 3, 4, 5, 6, 7, 8,.9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
222 printf("#0221:%d %d %d %d %d %d %d %d %d %d %f %f\n", |
496 | 223 1, 1, 2, 3, 4, 5, 6, 7, 8, 9,.1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
224 printf("#0223:%d %d %d %d %d %d %d %d %d %d %d %f\n", |
496 | 225 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1,.2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
226 printf("#0225:%d %d %d %d %d %d %d %d %d %d %d %d\n", |
496 | 227 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); |
228 | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
229 printf("#0228:%f %d %d %d %d %d %d %d %d %d %d %d\n", |
496 | 230 .1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
231 printf("#0230:%f %f %d %d %d %d %d %d %d %d %d %d\n", |
496 | 232 .1, .1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
233 printf("#0232:%f %f %f %d %d %d %d %d %d %d %d %d\n", |
496 | 234 .1, .1,.2, 3, 4, 5, 6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
235 printf("#0234:%f %f %f %f %d %d %d %d %d %d %d %d\n", |
496 | 236 .1, .1,.2,.3, 4, 5, 6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
237 printf("#0236:%f %f %f %f %f %d %d %d %d %d %d %d\n", |
496 | 238 .1, .1,.2,.3,.4, 5, 6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
239 printf("#0238:%f %f %f %f %f %f %d %d %d %d %d %d\n", |
496 | 240 .1, .1,.2,.3,.4,.5, 6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
241 printf("#0240:%f %f %f %f %f %f %f %d %d %d %d %d\n", |
496 | 242 .1, .1,.2,.3,.4,.5,.6, 7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
243 printf("#0242:%f %f %f %f %f %f %f %f %d %d %d %d\n", |
496 | 244 .1, .1,.2,.3,.4,.5,.6,.7, 8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
245 printf("#0244:%f %f %f %f %f %f %f %f %f %d %d %d\n", |
496 | 246 .1, .1,.2,.3,.4,.5,.6,.7,.8, 9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
247 printf("#0246:%f %f %f %f %f %f %f %f %f %f %d %d\n", |
496 | 248 .1, .1,.2,.3,.4,.5,.6,.7,.8,.9, 1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
249 printf("#0248:%f %f %f %f %f %f %f %f %f %f %f %d\n", |
496 | 250 .1, .1,.2,.3,.4,.5,.6,.7,.8,.9,.1, 2); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
251 printf("#0250:%f %f %f %f %f %f %f %f %f %f %f %f\n", |
496 | 252 .1, .1,.2,.3,.4,.5,.6,.7,.8,.9,.1,.2); |
253 | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
254 printf("#0253:%f %d %f %d %f %d %f %d %f %d %f %d\n", |
496 | 255 .1, 1,.2, 3,.4, 5,.6, 7,.8, 9,.1, 2); |
256 | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
257 printf("#0256:%d %f %d %f %d %f %d %f %d %f %d %f\n", |
496 | 258 1, .1, 2,.3, 4,.5, 6,.7, 8,.9, 1,.2); |
259 } | |
260 | |
261 | |
488 | 262 int |
89 | 263 main() { |
264 print(1.0); | |
265 print(0.1234); | |
266 print(1.234e10); | |
267 print(1.234e-10); | |
108 | 268 tmp1(); |
496 | 269 double_int(); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
270 printf("#0269:%s", memchar ); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
676
diff
changeset
|
271 printf("#0270:%s", arraychar); |
172 | 272 return 0; |
89 | 273 } |