+ ir_mode *cmp_mode;
+ ir_node *cmp_sel;
+ ir_node *sel_block;
+
+ /* Get the mode and sel node for the comparison. */
+ cmp_mode = get_irn_mode(env->sel);
+ cmp_sel = env->sel;
+ sel_block = get_nodes_block(cmp_sel);
+
+ /*
+ * Make sure that an unsigned comparison is used, by converting the sel
+ * node to an unsigned mode and using that mode for the constants, too.
+ * This is important, because the qsort applied to the case labels uses
+ * an unsigned comparison and both comparison methods have to match.
+ */
+ if (mode_is_signed(cmp_mode))
+ {
+ cmp_mode = find_unsigned_mode(cmp_mode);
+ cmp_sel = new_r_Conv(sel_block, cmp_sel, cmp_mode);
+ }
+