Since the OP_SETCC instructions can only return a 0 or a 1, a sign-extension won't change the value if the size is wider than 1. The OP_SETCC can thus be changed to directly return the extended size. Remove the unneeded extension. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 4 ++++ validation/optim/setne0-sext.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index 9927dd240..728647a3e 100644 --- a/simplify.c +++ b/simplify.c @@ -1191,6 +1191,10 @@ static int simplify_cast(struct instruction *insn) break; case OP_FPCMP ... OP_BINCMP_END: switch (insn->opcode) { + case OP_SEXT: + if (insn->size == 1) + break; + /* fall through */ case OP_ZEXT: // simplify: // setcc.n %t <- %a, %b diff --git a/validation/optim/setne0-sext.c b/validation/optim/setne0-sext.c index 565f8df24..4167979b8 100644 --- a/validation/optim/setne0-sext.c +++ b/validation/optim/setne0-sext.c @@ -3,7 +3,6 @@ long foo(int a) { return a != 0; } /* * check-name: setne0-sext * check-command: test-linearize -m64 -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: sext\\. -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html