aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/simplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'simplify.c')
-rw-r--r--simplify.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/simplify.c b/simplify.c
index 9e3514d8..99f1d045 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1266,10 +1266,14 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
case OP_SET_EQ:
if ((value & bits) != value)
return replace_with_value(insn, 0);
+ if (value == bits && is_power_of_2(bits))
+ return replace_binop_value(insn, OP_SET_NE, 0);
break;
case OP_SET_NE:
if ((value & bits) != value)
return replace_with_value(insn, 1);
+ if (value == bits && is_power_of_2(bits))
+ return replace_binop_value(insn, OP_SET_EQ, 0);
break;
case OP_SET_LE:
value = sign_extend(value, def->size);