@@ -713,6 +713,16 @@ static int simplify_seteq_setne(struct instruction *insn, long long value)
}
opcode = def->opcode;
switch (opcode) {
+ case OP_AND:
+ if (inverse)
+ break;
+ if (def->size != insn->size)
+ break;
+ if (def->src2->type != PSEUDO_VAL)
+ break;
+ if (def->src2->value != 1)
+ break;
+ return replace_with_pseudo(insn, old);
case OP_FPCMP ... OP_BINCMP_END:
// Convert:
// setcc.n %t <- %a, %b
@@ -16,7 +16,6 @@ int foo(struct s x)
/*
* check-name: mask1-setne0
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-start
foo:
Since the OP_SETCC instructions can only return a 0 or a 1, a compare-not-equal-zero or compare-equal-1 is a no-op if the operand have been masked with 1. Remove the no-op comparison (if the size matches). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- simplify.c | 10 ++++++++++ validation/optim/mask1-setne0.c | 1 - 2 files changed, 10 insertions(+), 1 deletion(-)