if ((mode_is_int(mode) || mode_is_reference(mode)) && (
get_mode_size_bits(mode) < get_mode_size_bits(lowered_mode) ||
- (is_Const(right) && is_Const_null(right))
+ (mode_is_signed(mode) && is_Const(right) && is_Const_null(right))
)) {
int pnc = get_Proj_proj(node);
int need_not = 0;
a = left;
b = right;
} else if(pnc == pn_Cmp_Le) {
- /* a <= b -> ((a - b) >> 31) ^ 1 */
+ /* a <= b -> ~(a - b) >> 31 */
a = right;
b = left;
need_not = 1;
a = right;
b = left;
} else if(pnc == pn_Cmp_Ge) {
- /* a >= b -> ((a - b) >> 31) ^ 1 */
+ /* a >= b -> ~(a - b) >> 31 */
a = left;
b = right;
need_not = 1;
}
if(a != NULL) {
- tarval *tv = new_tarval_from_long(31, mode_Iu);
+ tarval *tv = new_tarval_from_long(get_mode_size_bits(lowered_mode) - 1, mode_Iu);
ir_node *shift_cnt = new_d_Const(dbgi, mode_Iu, tv);
if(mode != lowered_mode) {
}
res = new_rd_Sub(dbgi, irg, block, a, b, lowered_mode);
+ if(need_not) {
+ res = new_rd_Not(dbgi, irg, block, res, lowered_mode);
+ }
res = new_rd_Shr(dbgi, irg, block, res, shift_cnt,
lowered_mode);
- if(need_not) {
- res = create_not(dbgi, res);
- }
set_irn_link(node, res);
return res;
}