annotate test/offset.c @ 558:528fed826f17 partial-evaluation

const value switch statement prune.
author kono
date Sat, 07 Jan 2006 12:46:38 +0900
parents ef225b589888
children a4445cb1aa91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
556
ef225b589888 s-dandy fix
kono
parents: 427
diff changeset
1 extern int printf(const char *,...);
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
2
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
3 #define BIT8 260
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
4 #define BIT10 1030
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
5 #define BIT12 5000
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
6 #define BIT16 (65536*2)
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
7
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
8 int midium[BIT12];
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
9 int large[BIT16];
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
10
556
ef225b589888 s-dandy fix
kono
parents: 427
diff changeset
11 int
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
12 main0(int ac,char *av[])
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
13 {
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
14 int *p;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
15 int local_midium[BIT12];
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
16 int local_large[BIT16];
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
17
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
18 #if 0
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
19 printf("#0018:int ac =\t%x\n",&ac);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
20 printf("#0019:int midium[0] =\t%x\n",&midium[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
21 printf("#0020:int midium[BIT12] =\t%x\n",&midium[BIT12]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
22 printf("#0021:int large[0] =\t%x\n",&large[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
23 printf("#0022:int large[BIT16] =\t%x\n",&large[BIT16]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
24 printf("#0023:int local_midium[0] =\t%x\n",&local_midium[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
25 printf("#0024:int local_midium[BIT12] =\t%x\n",&local_midium[BIT12]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
26 printf("#0025:int local_large[0] =\t%x\n",&local_large[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
27 printf("#0026:int local_large[BIT16] =\t%x\n",&local_large[BIT16]);
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
28 #endif
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
29
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
30 midium[0]=0x55;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
31 large[0]=0x55;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
32 local_midium[0]=0x55;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
33 local_large[0]=0x55;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
34
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
35 midium[BIT8]=0x50;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
36 large[BIT8]=0x50;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
37 local_midium[BIT8]=0x50;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
38 local_large[BIT8]=0x50;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
39
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
40 midium[BIT10]=0xa0;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
41 large[BIT10]=0xa0;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
42 local_midium[BIT10]=0xa0;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
43 local_large[BIT10]=0xa0;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
44
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
45 midium[BIT12-1]=0xaa;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
46 large[BIT16-1]=0xaa;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
47 local_midium[BIT12-1]=0xaa;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
48 local_large[BIT16-1]=0xaa;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
49
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
50 printf("#0049:%x\n", midium[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
51 printf("#0050:%x\n", large[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
52 printf("#0051:%x\n", local_midium[0]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
53 printf("#0052:%x\n", local_large[0]);
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
54
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
55 printf("#0054:%x\n", midium[BIT8]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
56 printf("#0055:%x\n", large[BIT8]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
57 printf("#0056:%x\n", local_midium[BIT8]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
58 printf("#0057:%x\n", local_large[BIT8]);
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
59
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
60 printf("#0059:%x\n", midium[BIT10]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
61 printf("#0060:%x\n", large[BIT10]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
62 printf("#0061:%x\n", local_midium[BIT10]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
63 printf("#0062:%x\n", local_large[BIT10]);
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
64
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
65 printf("#0064:%x\n", midium[BIT12-1]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
66 printf("#0065:%x\n", large[BIT16-1]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
67 printf("#0066:%x\n", local_midium[BIT12-1]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
68 printf("#0067:%x\n", local_large[BIT16-1]);
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
69
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
70 p = local_large+BIT16;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
71
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
72 p[-1] = 0xaa;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
73 p[-BIT8] = 0xbb;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
74 p[-BIT10] = 0xcc;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
75 p[-(BIT12-1)] = 0xdd;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
76 p[-(BIT16-1)] = 0xee;
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
77
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
78 printf("#0077:%x\n", p[-1]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
79 printf("#0078:%x\n", p[-BIT8]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
80 printf("#0079:%x\n", p[-BIT10]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
81 printf("#0080:%x\n", p[-(BIT12-1)]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
82 printf("#0081:%x\n", p[-(BIT16-1)]);
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
83
377
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
84 p = large+BIT16;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
85
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
86 p[-1] = 0xaa;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
87 p[-BIT8] = 0xbb;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
88 p[-BIT10] = 0xcc;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
89 p[-(BIT12-1)] = 0xdd;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
90 p[-(BIT16-1)] = 0xee;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
91
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
92 printf("#0091:%x\n", p[-1]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
93 printf("#0092:%x\n", p[-BIT8]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
94 printf("#0093:%x\n", p[-BIT10]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
95 printf("#0094:%x\n", p[-(BIT12-1)]);
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
96 printf("#0095:%x\n", p[-(BIT16-1)]);
377
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
97
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
98
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
99 for(p=local_midium;p<&local_midium[BIT12];p++) *p = p-local_midium;
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
100 for(p=local_large;p<&local_large[BIT16];p++) *p = p-local_large;
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
101
377
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
102 for(p=midium;p<&midium[BIT12];p++) *p = p-midium;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
103 for(p=large;p<&large[BIT16];p++) *p = p-large;
b23568be1155 ARM continue (const table)
kono
parents: 375
diff changeset
104
373
a9bc85fe6702 *** empty log message ***
kono
parents:
diff changeset
105 }
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
106
556
ef225b589888 s-dandy fix
kono
parents: 427
diff changeset
107 int
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
108 main(int ac,char *av[])
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
109 {
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
110 int i=-1,j=-2,k=-3;
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
111
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
112 main0(ac,av);
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
113
558
528fed826f17 const value switch statement prune.
kono
parents: 556
diff changeset
114 printf("#0113:%d %d %d %d\n",ac,i,j,k);
375
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
115 return 0;
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
116 }
91849fdeea60 PowerPC large offset.
kono
parents: 373
diff changeset
117