annotate test/long.c @ 244:39e28d6cfa56 ia32-long-long-done

ia32 long long done
author kono
date Thu, 06 May 2004 01:02:06 +0900
parents 2208a18f3799
children 3e8ba7024d25
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
1
ce0c38b6c85e try long long
kono
parents:
diff changeset
2 long long gj;
ce0c38b6c85e try long long
kono
parents:
diff changeset
3 long long gi;
ce0c38b6c85e try long long
kono
parents:
diff changeset
4
ce0c38b6c85e try long long
kono
parents:
diff changeset
5 long long a[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
6 unsigned long long b[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
7 unsigned long long c[100];
ce0c38b6c85e try long long
kono
parents:
diff changeset
8
ce0c38b6c85e try long long
kono
parents:
diff changeset
9 long long data[] = {2342342342304234LL,2342342340234234LL, -2342342342340234LL};
ce0c38b6c85e try long long
kono
parents:
diff changeset
10 unsigned long long udata[] = {2342342334234LL,23423423434234LL,
ce0c38b6c85e try long long
kono
parents:
diff changeset
11 -234234234234234LL};
ce0c38b6c85e try long long
kono
parents:
diff changeset
12
ce0c38b6c85e try long long
kono
parents:
diff changeset
13 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
14 unsigned
ce0c38b6c85e try long long
kono
parents:
diff changeset
15 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
16
ce0c38b6c85e try long long
kono
parents:
diff changeset
17 void
ce0c38b6c85e try long long
kono
parents:
diff changeset
18 test3();
ce0c38b6c85e try long long
kono
parents:
diff changeset
19
ce0c38b6c85e try long long
kono
parents:
diff changeset
20 float f2ll(long long i) { float r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
21 r = i ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
22 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
23 double d2ll(long long i) { double 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 float f2ull(unsigned long long i) { float 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 double d2ull(unsigned long long i) { double 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 long long ll2f(float f) { long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
33 r = f ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
34 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
35 long long ll2d(double d) { long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
36 r = d ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
37 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
38 unsigned long long ull2f(float f) { unsigned long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
39 r = f ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
40 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
41 unsigned long long ull2d(double d) { unsigned long long r;
ce0c38b6c85e try long long
kono
parents:
diff changeset
42 r = d ;
ce0c38b6c85e try long long
kono
parents:
diff changeset
43 return r; }
ce0c38b6c85e try long long
kono
parents:
diff changeset
44
ce0c38b6c85e try long long
kono
parents:
diff changeset
45 main()
ce0c38b6c85e try long long
kono
parents:
diff changeset
46 {
233
2208a18f3799 *** empty log message ***
kono
parents: 232
diff changeset
47 long long int ii;
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
48 long long i,k,*p;
ce0c38b6c85e try long long
kono
parents:
diff changeset
49 unsigned long long j,m,*up;
ce0c38b6c85e try long long
kono
parents:
diff changeset
50 unsigned long long g0,h0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
51 long long g1,h1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
52 unsigned long long sg0,sh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
53 long long sg1,sh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
54 unsigned long long *pg0,*ph0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
55 long long *pg1,*ph1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
56 unsigned long long *psg0,*psh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
57 long long *psg1,*psh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
58
ce0c38b6c85e try long long
kono
parents:
diff changeset
59
ce0c38b6c85e try long long
kono
parents:
diff changeset
60 i = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
61 j = 3424223422342234224LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
62 k = 44;
ce0c38b6c85e try long long
kono
parents:
diff changeset
63 k = i*j+3+k;
ce0c38b6c85e try long long
kono
parents:
diff changeset
64 m = i*j-7+k;
ce0c38b6c85e try long long
kono
parents:
diff changeset
65 printf("%lld %lld %llu\n",i,k,m);
ce0c38b6c85e try long long
kono
parents:
diff changeset
66 printf("%lld %lld %llu\n",i,1231234234233LL,m);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
67 printf("0x%llx 0x%llx 0x%llx\n",i,k,m);
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
68 printf("0x%llx 0x%llx 0x%llx\n",i,1231234234233LL,m);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
69
ce0c38b6c85e try long long
kono
parents:
diff changeset
70 g0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
71 g0++; --g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
72 ++g0; g0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
73 printf("g0=%lld\n",g0);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
74 printf("g0=0x%llx\n",g0);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
75 g1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
76 g1++; --g1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
77 ++g1; g1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
78 printf("g1=%lld\n",g1);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
79 printf("g1=0x%llx\n",g1);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
80
ce0c38b6c85e try long long
kono
parents:
diff changeset
81 sg0 = 2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
82 sg0++; --sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
83 ++sg0; sg0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
84 printf("sg0=%lld\n",sg0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
85 sg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
86 sg1++; --sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
87 ++sg1; sg1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
88 printf("sg1=%lld\n",sg1);
ce0c38b6c85e try long long
kono
parents:
diff changeset
89
ce0c38b6c85e try long long
kono
parents:
diff changeset
90 pg0 = &g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
91 ph0 = &h0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
92 *pg0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
93 //*pg0++; *--pg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
94 //*++pg0; *g0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
95 printf("g0=%lld\n",*pg0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
96 pg1 = &g1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
97 ph1 = &h1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
98 *pg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
99 //*pg1++; --*pg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
100 //++*pg1; *pg1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
101 printf("g1=%lld\n",*pg1);
ce0c38b6c85e try long long
kono
parents:
diff changeset
102
ce0c38b6c85e try long long
kono
parents:
diff changeset
103 psg0 = &sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
104 psh0 = &sh0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
105 *psg0 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
106 //*sg0++; *--sg0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
107 //*++sg0; *sg0--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
108 printf("sg0=%lld\n",*psg0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
109 psg1 = &sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
110 psh1 = &sh1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
111 *psg1 = -2343423423424234234LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
112 //*sg1++; *--sg1;
ce0c38b6c85e try long long
kono
parents:
diff changeset
113 //*++sg1; *sg1--;
ce0c38b6c85e try long long
kono
parents:
diff changeset
114 printf("sg1=%lld\n",*psg1);
ce0c38b6c85e try long long
kono
parents:
diff changeset
115
ce0c38b6c85e try long long
kono
parents:
diff changeset
116
ce0c38b6c85e try long long
kono
parents:
diff changeset
117 h0 = g0 - 20;
ce0c38b6c85e try long long
kono
parents:
diff changeset
118 c[33] = g0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
119
ce0c38b6c85e try long long
kono
parents:
diff changeset
120 if (i==j) { printf("i==j\n"); } else { printf("i!=j\n"); }
ce0c38b6c85e try long long
kono
parents:
diff changeset
121
ce0c38b6c85e try long long
kono
parents:
diff changeset
122 a[33] = i;
ce0c38b6c85e try long long
kono
parents:
diff changeset
123 b[33] = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
124 printf("i=%lld\n",i);
ce0c38b6c85e try long long
kono
parents:
diff changeset
125 printf("j=%lld\n",j);
ce0c38b6c85e try long long
kono
parents:
diff changeset
126 i++; --i;
ce0c38b6c85e try long long
kono
parents:
diff changeset
127 j++; --j;
ce0c38b6c85e try long long
kono
parents:
diff changeset
128 printf("i=%lld\n",i);
ce0c38b6c85e try long long
kono
parents:
diff changeset
129 printf("j=%lld\n",j);
ce0c38b6c85e try long long
kono
parents:
diff changeset
130 gi = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
131 gj = 2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
132 gi++; --gi;
ce0c38b6c85e try long long
kono
parents:
diff changeset
133 gj++; --gj;
ce0c38b6c85e try long long
kono
parents:
diff changeset
134 printf("gi=%lld\n",gi);
ce0c38b6c85e try long long
kono
parents:
diff changeset
135 printf("gj=%lld\n",gj);
ce0c38b6c85e try long long
kono
parents:
diff changeset
136
ce0c38b6c85e try long long
kono
parents:
diff changeset
137 printf("k=%lld\n",k);
ce0c38b6c85e try long long
kono
parents:
diff changeset
138 printf("m=%lld\n",m);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
139 printf("k=0x%llx\n",k);
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
140 printf("m=0x%llx\n",m);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
141 printf("a[33]=%lld\n",a[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
142 printf("b[33]=%lld\n",b[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
143 printf("a[33]=%lld\n",++a[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
144 printf("b[33]=%lld\n",b[33]--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
145
ce0c38b6c85e try long long
kono
parents:
diff changeset
146 printf("g0=%lld\n",g0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
147 printf("h0=%lld\n",h0);
ce0c38b6c85e try long long
kono
parents:
diff changeset
148 printf("c[33]=%lld\n",c[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
149
ce0c38b6c85e try long long
kono
parents:
diff changeset
150 p = data;
ce0c38b6c85e try long long
kono
parents:
diff changeset
151 printf("*p++ = %lld\n",*p++);
ce0c38b6c85e try long long
kono
parents:
diff changeset
152 printf("*++p = %lld\n",*++p);
ce0c38b6c85e try long long
kono
parents:
diff changeset
153 *p++ = -2342342342342342342LL;
ce0c38b6c85e try long long
kono
parents:
diff changeset
154 printf("*p-- = %lld\n",*p--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
155 printf("*--p = %lld\n",*--p);
ce0c38b6c85e try long long
kono
parents:
diff changeset
156 up = udata;
ce0c38b6c85e try long long
kono
parents:
diff changeset
157 printf("*up-- = %lld\n",*up--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
158 printf("*--up = %lld\n",*--up);
ce0c38b6c85e try long long
kono
parents:
diff changeset
159 *up++ = 65530;
ce0c38b6c85e try long long
kono
parents:
diff changeset
160 printf("*up-- = %lld\n",*up--);
ce0c38b6c85e try long long
kono
parents:
diff changeset
161 printf("*--up = %lld\n",*--up);
ce0c38b6c85e try long long
kono
parents:
diff changeset
162
232
8a23c20ac92d *** empty log message ***
kono
parents: 222
diff changeset
163 printf("f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a[33]);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
164
ce0c38b6c85e try long long
kono
parents:
diff changeset
165 ii = f(i,j,k,m,a[33]);
ce0c38b6c85e try long long
kono
parents:
diff changeset
166 printf("f()=%lld\n",ii);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
167 printf("f()=0x%llx\n",ii);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
168 ii = g(i,j,k,m,a[33]);
222
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
169 printf("g()=%lld\n",ii);
3d214303bae9 *** empty log message ***
kono
parents: 193
diff changeset
170 printf("g()=0x%llx\n",ii);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
171 test3();
ce0c38b6c85e try long long
kono
parents:
diff changeset
172 return 0;
ce0c38b6c85e try long long
kono
parents:
diff changeset
173 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
174
ce0c38b6c85e try long long
kono
parents:
diff changeset
175 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
176 {
232
8a23c20ac92d *** empty log message ***
kono
parents: 222
diff changeset
177 printf("f(%lld %llu %llu %lld %lld)\n",i,j,k,m,a);
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
178 return i+j*k-m/a;
ce0c38b6c85e try long long
kono
parents:
diff changeset
179 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
180
ce0c38b6c85e try long long
kono
parents:
diff changeset
181 unsigned
ce0c38b6c85e try long long
kono
parents:
diff changeset
182 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
183 {
ce0c38b6c85e try long long
kono
parents:
diff changeset
184 return i+j*k-m/a;
ce0c38b6c85e try long long
kono
parents:
diff changeset
185 }
ce0c38b6c85e try long long
kono
parents:
diff changeset
186
ce0c38b6c85e try long long
kono
parents:
diff changeset
187 void
ce0c38b6c85e try long long
kono
parents:
diff changeset
188 test3()
ce0c38b6c85e try long long
kono
parents:
diff changeset
189 {
244
39e28d6cfa56 ia32 long long done
kono
parents: 233
diff changeset
190 printf("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
191 f2ll((long long ) -3423423234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
192 d2ll((long long ) -3423423234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
193 f2ull((unsigned long long ) 34234234234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
194 d2ull((unsigned long long ) 34234234234234LL),
244
39e28d6cfa56 ia32 long long done
kono
parents: 233
diff changeset
195 ll2f((float ) 2342423423423424234LL),
193
ce0c38b6c85e try long long
kono
parents:
diff changeset
196 ll2d((double ) 2344234234244234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
197 ull2f((float ) 2344234234244234234LL),
ce0c38b6c85e try long long
kono
parents:
diff changeset
198 ull2d((double )2332342343234234234LL)
ce0c38b6c85e try long long
kono
parents:
diff changeset
199 );
ce0c38b6c85e try long long
kono
parents:
diff changeset
200
ce0c38b6c85e try long long
kono
parents:
diff changeset
201 }