@@ -1271,6 +1271,8 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
return replace_with_value(insn, 0);
if (value >= (long long)bits)
return replace_with_value(insn, 1);
+ if (value == 0)
+ return replace_opcode(insn, OP_SET_EQ);
break;
case OP_SET_GT:
value = sign_extend(value, def->size);
@@ -1280,6 +1282,8 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
return replace_with_value(insn, 1);
if (value >= (long long)bits)
return replace_with_value(insn, 0);
+ if (value == 0)
+ return replace_opcode(insn, OP_SET_NE);
break;
case OP_SET_B:
if (value > bits)
@@ -6,7 +6,6 @@ int cmps_and_sgt0(int a) { return ((a & M) > 0) == ((a & M) != 0); }
/*
* check-name: cmps0-and
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-returns: 1
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- simplify.c | 4 ++++ validation/optim/cmps0-and0.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-)