-#define reassoc_Add reassoc_commutative
-#define reassoc_And reassoc_commutative
-#define reassoc_Or reassoc_commutative
-#define reassoc_Eor reassoc_commutative
+ if (l == c1) {
+ /* convert x .OP. (x .OP. y) => y .OP. (x .OP. x) */
+ ir_mode *mode_res = get_irn_mode(n);
+ ir_mode *mode_c1 = get_irn_mode(c1);
+ ir_graph *irg = get_irn_irg(c1);
+ ir_node *irn, *in[2];
+
+ in[0] = c1;
+ in[1] = c1;
+
+ in[1] = optimize_node(new_ir_node(NULL, irg, block, op, mode_c1, 2, in));
+ in[0] = r;
+
+ irn = optimize_node(new_ir_node(NULL, irg, block, op, mode_res, 2, in));
+
+ DBG((dbg, LEVEL_5, "Applied: %n .%s. (%n .%s. %n) => %n .%s. (%n .%s. %n)\n",
+ c1, get_irn_opname(n), l, get_irn_opname(n), r,
+ r, get_irn_opname(n), c1, get_irn_opname(n), c1));
+
+ if (n != irn) {
+ exchange(n, irn);
+ *node = irn;
+ return 1;
+ }
+ }
+ }
+ return 0;
+}