annotate test/long.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 ba7110017db5
children 5313ed059cee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
32737bad7489 fix list/tag interference
kono
parents: 427
diff changeset
1 int printf(const char *format, ...);
32737bad7489 fix list/tag interference
kono
parents: 427
diff changeset
2
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
3
ce0c38b6c85e try long long
kono
parents:
diff changeset
4 long long gj;
ce0c38b6c85e try long long
kono
parents:
diff changeset
5 long long gi;
ce0c38b6c85e try long long
kono
parents:
diff changeset
6
ce0c38b6c85e try long long
kono
parents:
diff changeset
7 long long a[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
8 unsigned long long b[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
9 unsigned long long c[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
10
279
3e8ba7024d25 MIPS struct fix (all test except 2 passed.)
kono
parents: 244
diff changeset
11 long long data[] = {2342342342304234LL,2342342340234234LL,
3e8ba7024d25 MIPS struct fix (all test except 2 passed.)
kono
parents: 244
diff changeset
12 -234234342340234LL, -2342342342340234LL };
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
13 unsigned long long udata[] = {2342342334234LL,23423423434234LL,
279
3e8ba7024d25 MIPS struct fix (all test except 2 passed.)
kono
parents: 244
diff changeset
14 -23423423234234LL, -234234234234234LL};
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
15
ce0c38b6c85e try long long
kono
parents:
diff changeset
16 long long f(long long i,unsigned long long j,unsigned long long k,long long m,long long a);
ce0c38b6c85e try long long
kono
parents:
diff changeset
17 unsigned
ce0c38b6c85e try long long
kono
parents:
diff changeset
18 long long g(long long i,unsigned long long j,unsigned long long k,long long m,long long a);
ce0c38b6c85e try long long
kono
parents:
diff changeset
19
ce0c38b6c85e try long long
kono
parents:
diff changeset
20 void
ce0c38b6c85e try long long
kono
parents:
diff changeset
21 test3();
ce0c38b6c85e try long long
kono
parents:
diff changeset
22
ce0c38b6c85e try long long
kono
parents:
diff changeset
23 float f2ll(long long i) { float r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
24 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
25 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
26 double d2ll(long long i) { double r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
27 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
28 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
29 float f2ull(unsigned long long i) { float r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
30 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
31 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
32 double d2ull(unsigned long long i) { double r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
33 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
34 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
35 long long ll2f(float f) { long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
36 r = f ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
37 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
38 long long ll2d(double d) { long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
39 r = d ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
40 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
41 unsigned long long ull2f(float f) { unsigned long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
42 r = f ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
43 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
44 unsigned long long ull2d(double d) { unsigned long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
45 r = d ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
46 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
47
ce0c38b6c85e try long long
kono
parents:
diff changeset
48 main()
ce0c38b6c85e try long long
kono
parents:
diff changeset
49 {
233
2208a18f3799 *** empty log message ***
kono
parents: 232
diff changeset
50 long long int ii;
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
51 long long i,k,*p;
ce0c38b6c85e try long long
kono
parents:
diff changeset
52 unsigned long long j,m,*up;
ce0c38b6c85e try long long
kono
parents:
diff changeset
53 unsigned long long g0,h0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
54 long long g1,h1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
55 unsigned long long sg0,sh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
56 long long sg1,sh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
57 unsigned long long *pg0,*ph0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
58 long long *pg1,*ph1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
59 unsigned long long *psg0,*psh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
60 long long *psg1,*psh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
61
ce0c38b6c85e try long long
kono
parents:
diff changeset
62
ce0c38b6c85e try long long
kono
parents:
diff changeset
63 i = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
64 j = 3424223422342234224LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
65 k = 44;
ce0c38b6c85e try long long
kono
parents:
diff changeset
66 k = i*j+3+k;
ce0c38b6c85e try long long
kono
parents:
diff changeset
67 m = i*j-7+k;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
68 printf("#0067:%lld %lld %llu\n",i,k,m);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
69 printf("#0068:%lld %lld %llu\n",i,1231234234233LL,m);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
70 printf("#0069:0x%llx 0x%llx 0x%llx\n",i,k,m);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
71 printf("#0070:0x%llx 0x%llx 0x%llx\n",i,1231234234233LL,m);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
72
ce0c38b6c85e try long long
kono
parents:
diff changeset
73 g0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
74 g0++; --g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
75 ++g0; g0--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
76 printf("#0075:g0=%lld\n",g0);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
77 printf("#0076:g0=0x%llx\n",g0);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
78 g1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
79 g1++; --g1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
80 ++g1; g1--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
81 printf("#0080:g1=%lld\n",g1);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
82 printf("#0081:g1=0x%llx\n",g1);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
83
ce0c38b6c85e try long long
kono
parents:
diff changeset
84 sg0 = 2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
85 sg0++; --sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
86 ++sg0; sg0--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
87 printf("#0086:sg0=%lld\n",sg0);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
88 sg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
89 sg1++; --sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
90 ++sg1; sg1--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
91 printf("#0090:sg1=%lld\n",sg1);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
92
ce0c38b6c85e try long long
kono
parents:
diff changeset
93 pg0 = &g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
94 ph0 = &h0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
95 *pg0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
96 //*pg0++; *--pg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
97 //*++pg0; *g0--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
98 printf("#0097:g0=%lld\n",*pg0);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
99 pg1 = &g1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
100 ph1 = &h1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
101 *pg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
102 //*pg1++; --*pg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
103 //++*pg1; *pg1--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
104 printf("#0103:g1=%lld\n",*pg1);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
105
ce0c38b6c85e try long long
kono
parents:
diff changeset
106 psg0 = &sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
107 psh0 = &sh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
108 *psg0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
109 //*sg0++; *--sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
110 //*++sg0; *sg0--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
111 printf("#0110:sg0=%lld\n",*psg0);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
112 psg1 = &sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
113 psh1 = &sh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
114 *psg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
115 //*sg1++; *--sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
116 //*++sg1; *sg1--;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
117 printf("#0116:sg1=%lld\n",*psg1);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
118
ce0c38b6c85e try long long
kono
parents:
diff changeset
119
ce0c38b6c85e try long long
kono
parents:
diff changeset
120 h0 = g0 - 20;
ce0c38b6c85e try long long
kono
parents:
diff changeset
121 c[33] = g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
122
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
123 if (i==j) { printf("#0122:i==j\n"); } else { printf("#0122:i!=j\n"); }
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
124
ce0c38b6c85e try long long
kono
parents:
diff changeset
125 a[33] = i;
ce0c38b6c85e try long long
kono
parents:
diff changeset
126 b[33] = 2342342342342342342LL;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
127 printf("#0126:i=%lld\n",i);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
128 printf("#0127:j=%lld\n",j);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
129 i++; --i;
ce0c38b6c85e try long long
kono
parents:
diff changeset
130 j++; --j;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
131 printf("#0130:i=%lld\n",i);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
132 printf("#0131:j=%lld\n",j);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
133 gi = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
134 gj = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
135 gi++; --gi;
ce0c38b6c85e try long long
kono
parents:
diff changeset
136 gj++; --gj;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
137 printf("#0136:gi=%lld\n",gi);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
138 printf("#0137:gj=%lld\n",gj);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
139
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
140 printf("#0139:k=%lld\n",k);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
141 printf("#0140:m=%lld\n",m);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
142 printf("#0141:k=0x%llx\n",k);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
143 printf("#0142:m=0x%llx\n",m);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
144 printf("#0143:a[33]=%lld\n",a[33]);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
145 printf("#0144:b[33]=%lld\n",b[33]);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
146 printf("#0145:a[33]=%lld\n",++a[33]);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
147 printf("#0146:b[33]=%lld\n",b[33]--);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
148
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
149 printf("#0148:g0=%lld\n",g0);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
150 printf("#0149:h0=%lld\n",h0);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
151 printf("#0150:c[33]=%lld\n",c[33]);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
152
ce0c38b6c85e try long long
kono
parents:
diff changeset
153 p = data;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
154 printf("#0153:*p++ = %lld\n",*p++);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
155 printf("#0154:*++p = %lld\n",*++p);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
156 *p++ = -2342342342342342342LL;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
157 printf("#0156:*p-- = %lld\n",*p--);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
158 printf("#0157:*--p = %lld\n",*--p);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
159 up = udata;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
160 printf("#0159:*up-- = %lld\n",*up--);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
161 printf("#0160:*--up = %lld\n",*--up);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
162 *up++ = 65530;
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
163 printf("#0162:*up-- = %lld\n",*up--);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
164 printf("#0163:*--up = %lld\n",*--up);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
165
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
166 printf("#0165:f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a[33]);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
167
ce0c38b6c85e try long long
kono
parents:
diff changeset
168 ii = f(i,j,k,m,a[33]);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
169 printf("#0168:f()=%lld\n",ii);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
170 printf("#0169:f()=0x%llx\n",ii);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
171 ii = g(i,j,k,m,a[33]);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
172 printf("#0171:g()=%lld\n",ii);
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
173 printf("#0172:g()=0x%llx\n",ii);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
174 test3();
ce0c38b6c85e try long long
kono
parents:
diff changeset
175 return 0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
176 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
177
ce0c38b6c85e try long long
kono
parents:
diff changeset
178 long long f(long long i,unsigned long long j,unsigned long long k,long long m,long long a)
ce0c38b6c85e try long long
kono
parents:
diff changeset
179 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
180 printf("#0179:f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
181 return i+j*k-m/a;
ce0c38b6c85e try long long
kono
parents:
diff changeset
182 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
183
ce0c38b6c85e try long long
kono
parents:
diff changeset
184 unsigned
ce0c38b6c85e try long long
kono
parents:
diff changeset
185 long long g(long long i,unsigned long long j,unsigned long long k,long long m,long long a)
ce0c38b6c85e try long long
kono
parents:
diff changeset
186 {
ce0c38b6c85e try long long
kono
parents:
diff changeset
187 return i+j*k-m/a;
ce0c38b6c85e try long long
kono
parents:
diff changeset
188 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
189
ce0c38b6c85e try long long
kono
parents:
diff changeset
190 void
ce0c38b6c85e try long long
kono
parents:
diff changeset
191 test3()
ce0c38b6c85e try long long
kono
parents:
diff changeset
192 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
193 printf("#0192:test3-1:%g\ntest3-2:%g\ntest3-3:%g\ntest3-4:%g\ntest3-5:%lld\ntest3-6:%lld\ntest3-7:%llu\ntest3-8:%llu\n",
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
194 f2ll((long long ) -3423423234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
195 d2ll((long long ) -3423423234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
196 f2ull((unsigned long long ) 34234234234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
197 d2ull((unsigned long long ) 34234234234234LL),
244
39e28d6cfa56 ia32 long long done
kono
parents: 233
diff changeset
198 ll2f((float ) 2342423423423424234LL),
675
ba7110017db5 *** empty log message ***
kono
parents: 491
diff changeset
199 ll2d((double ) 234423423424423423LL),
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
200 ull2f((float ) 2344234234244234234LL),
675
ba7110017db5 *** empty log message ***
kono
parents: 491
diff changeset
201 ull2d((double )233234234323423423LL)
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
202 );
ce0c38b6c85e try long long
kono
parents:
diff changeset
203
ce0c38b6c85e try long long
kono
parents:
diff changeset
204 }