2 * This test case should provoke incompatible heuristical decision of the
3 * PBQP solver, which lead to infinity cost, i.e. no solution of the PBQP could
6 * It is necessary to manipulation some cost vectors to let the PBQP solver
7 * "crash". More details are shown below.
9 * This also seems more a missing feature of the PBQP solver than a counter
10 * example against the PBQP approach for instruction selection.
14 unsigned *block1, *block2, *block3, *block4, *block5, *block6;
15 unsigned *block7, *block8,*block9,*block10,*block11;
16 volatile unsigned arr[100];
31 unsigned k3_3(char* base, unsigned i1, unsigned i2, unsigned i3, unsigned k1, unsigned k2, unsigned k3)
59 unsigned k3_3_2(char* base, int i1, int i2, int i3, int k1, int k2, int k3)
87 unsigned k3_3_am(char* base, unsigned i1, unsigned i2, unsigned i3, unsigned k1, unsigned k2, unsigned k3)
115 void full_am(unsigned base, int index, unsigned base2, int index2, unsigned base3, int index3, unsigned base4, int index4, unsigned base5, int index5)
118 * This is the core of this example.
119 * The following line can be done with one instruction
120 * (add with address mode) on x86.
121 * We provoke four heuristical decision on nodes of this address mode
122 * pattern. The mean idea is that the root (the add node) choose this
123 * pattern, but the decision on the shift const forbid these.
124 * To achieve this you have to manipulate the cost of the shift const by
126 * The other two heuristical decision ensure, that the two heuristical
127 * decision above are separated, i.e. there are at least two irreducible
128 * nodes between them.
130 unsigned ca = arr[index] + base;
133 * The following function ensure irreducible users of given nodes.
134 * All of these function have to be inlined.
137 /* users for shift const */
138 b = k3_3_am(block, h1, h2, h3, 2, 3, 4);
139 b = k3_3_am(block, h4, h5, h6, 2, 5, 6);
140 b = k3_3_am(block, h7, h8, h9, 2, 7, 8);
142 /* users for symconst */
143 unsigned cb = arr[index2] + base2;
144 b = k3_3(block1, cb, kb1, kb2, 101, 102, 103);
145 unsigned cc = arr[index3] + base3;
146 b = k3_3(block2, cc, kc1, kc2, 111, 112, 113);
147 unsigned cd = arr[index4] + base4;
148 b = k3_3(block3, cd, kd1, kd2, 121, 122, 123);
149 unsigned ce = arr[index5] + base5;
150 b = k3_3(block4, ce, ke1, ke2, 131, 132, 133);
152 /* users for offset */
153 b = k3_3_2(block5, 4 * index, g1, g2, 31, 32, 33);
154 b = k3_3_2(block6, 4 * index, g3, g4, 34, 35, 36);
155 b = k3_3_2(block7, 4 * index, g5, g6, 37, 38, 39);
156 b = k3_3_2(block8, 4 * index, g7, g8, 40, 41, 42);
158 /* users for computed value */
159 b = k3_3(block9, ca, k1, k2, 13, 14, 15);
160 b = k3_3(block10, ca, k3, k4, 16, 17, 18);
161 b = k3_3(block11, ca, k5, k6, 19, 20, 21);
164 int main(int argc, char **argv) {