2 * This test case shows that it's not possible to find a PBQP solution for
3 * arbitrary pattern sets.
5 * You also have to use the following compiler flags:
6 * -O3 -fno-reassociation
8 * Because of the disabled reassociation you have to add the following rule:
9 * - Add(Add(Shl(ShiftConst(), index=IR_node()), imm=Const()), base=IR_node())
11 * To get infinity costs you have to remove the following Lea rules:
12 * - Add(Shl(ShiftConst(), index=IR_node()), imm=Const())
13 * - Add(Shl(ShiftConst(), index=IR_node()), base=IR_node())
15 * For more details take a look at the diamond function.
19 unsigned *gi1, gi2, gi3, gi4, gi5;
20 unsigned *gi101, gi102, gi103, gi104, gi105;
21 unsigned *gi201, gi202, gi203, gi204, gi205;
22 unsigned *gi211, gi212, gi213, gi214, gi215;
23 unsigned *gi301, gi302, gi303, gi304, gi305;
24 unsigned *gi311, gi312, gi313, gi314, gi315;
25 unsigned *gi401, gi402, gi403, gi404, gi405;
26 unsigned *gi411, gi412, gi413, gi414, gi415;
27 unsigned *gi501, gi502, gi503, gi504, gi505;
28 unsigned *gi511, gi512, gi513, gi514, gi515;
29 unsigned *gi601, gi602, gi603, gi604, gi605;
30 unsigned *gi611, gi612, gi613, gi614, gi615;
31 unsigned *gi701, gi702, gi703, gi704, gi705;
32 unsigned *gi711, gi712, gi713, gi714, gi715;
33 unsigned *gi801, gi802, gi803, gi804, gi805;
34 unsigned *gi811, gi812, gi813, gi814, gi815;
38 int main(int argc, char **argv)
43 unsigned add_1_shift_users(unsigned i1, unsigned i2, unsigned i3,
44 char *k1, char *k2, char *k3,
45 unsigned **gp1, unsigned **gp2, unsigned **gp3, unsigned **gp4,
46 unsigned **gp5, unsigned **gp6, unsigned **gp7, unsigned **gp8,
48 const int c1, const int c2, const int c3)
50 unsigned tmp1 = i1 + c1;
51 unsigned tmp2 = (i2 << 3) + c2;
52 unsigned tmp3 = (i3 << 3) + c3;
69 unsigned add_3_add_const_shift_users(unsigned i1, unsigned i2, unsigned i3,
70 char *k1, char *k2, char *k3,
71 unsigned **gp1, unsigned **gp2, unsigned **gp3, unsigned **gp4,
72 unsigned **gp5, unsigned **gp6, unsigned **gp7, unsigned **gp8,
74 const int c1, const int c2)
76 unsigned tmp2 = (i2 << 3) + c1;
77 unsigned tmp3 = (i3 << 3) + c2;
97 * This is the basic structure.
105 * The basic idea is to make a heuristical "consume me" decision for "as".
106 * If "asb" and "asc" have no terminal rules which consumes "as", they also
107 * have to be consumed. Therefore "sum" has to consume both paths up to
108 * "as", which isn't possible.
110 unsigned as = a << 3;
111 unsigned asb = as + 123235;
112 unsigned asc = as + 235346;
113 unsigned sum = asb + asc;
117 /* Add 3 users for asb. */
118 use = add_3_add_const_shift_users(asb, gi1, gi2,
120 &gp[0], &gp[1], &gp[2], &gp[3], &gp[4], &gp[5], &gp[6], &gp[7], &gp[8],
123 /* Add 3 users for asc. */
124 use = add_3_add_const_shift_users(asc, gi101, gi102,
125 &gi103, &gi104, &gi105,
126 &gp[100], &gp[101], &gp[102], &gp[103], &gp[104], &gp[105], &gp[106], &gp[107], &gp[108],
129 /* Add 4 users for as. */
130 use = add_1_shift_users(as, gi201, gi202,
131 &gi203, &gi204, &gi205,
132 &gp[200], &gp[201], &gp[202], &gp[203], &gp[204], &gp[205], &gp[206], &gp[207], &gp[208],
134 use = add_1_shift_users(as, gi301, gi302,
135 &gi303, &gi304, &gi305,
136 &gp[300], &gp[301], &gp[302], &gp[303], &gp[304], &gp[305], &gp[306], &gp[307], &gp[308],
138 use = add_1_shift_users(as, gi401, gi402,
139 &gi403, &gi404, &gi405,
140 &gp[400], &gp[401], &gp[402], &gp[403], &gp[404], &gp[405], &gp[406], &gp[407], &gp[408],
142 use = add_1_shift_users(as, gi501, gi502,
143 &gi503, &gi504, &gi505,
144 &gp[500], &gp[501], &gp[502], &gp[503], &gp[504], &gp[505], &gp[506], &gp[507], &gp[508],