On 04/08/18 21:35, Luc Van Oostenryck wrote: > Since the OP_SETCC instructions can only return a 0 or a 1, > a zero-extension won't change the value and the OP_SETCC > can be changed to directly return the extended size. > > Remove the unneeded extension.:wq s/:wq// ? (I guess you use vim too! ;-) ). ATB, Ramsay Jones > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> > --- > simplify.c | 13 +++++++++++++ > validation/optim/bool-simplify.c | 9 +++------ > validation/optim/setne0-zext.c | 1 - > validation/optim/trunc-seteq0.c | 1 - > 4 files changed, 16 insertions(+), 8 deletions(-) > > diff --git a/simplify.c b/simplify.c > index 911bfde7e..9927dd240 100644 > --- a/simplify.c > +++ b/simplify.c > @@ -1189,6 +1189,19 @@ static int simplify_cast(struct instruction *insn) > return REPEAT_CSE; > } > break; > + case OP_FPCMP ... OP_BINCMP_END: > + switch (insn->opcode) { > + case OP_ZEXT: > + // simplify: > + // setcc.n %t <- %a, %b > + // zext.m %r <- (n) %t > + // into: > + // setcc.m %r <- %a, %b > + insn->opcode = def->opcode; > + use_pseudo(insn, def->src2, &insn->src2); > + return replace_pseudo(insn, &insn->src1, def->src1); > + } > + break; > case OP_TRUNC: > osize = def->orig_type->bit_size; > if (insn->opcode == OP_ZEXT && size == osize) { > diff --git a/validation/optim/bool-simplify.c b/validation/optim/bool-simplify.c > index 68aabb782..b872764ca 100644 > --- a/validation/optim/bool-simplify.c > +++ b/validation/optim/bool-simplify.c > @@ -43,16 +43,14 @@ and_0: > and_1: > .L2: > <entry-point> > - setne.1 %r8 <- %arg1, $0 > - zext.32 %r11 <- (1) %r8 > + setne.32 %r11 <- %arg1, $0 > ret.32 %r11 > > > or_0: > .L4: > <entry-point> > - setne.1 %r14 <- %arg1, $0 > - zext.32 %r17 <- (1) %r14 > + setne.32 %r17 <- %arg1, $0 > ret.32 %r17 > > > @@ -65,8 +63,7 @@ or_1: > and_2: > .L8: > <entry-point> > - setne.1 %r26 <- %arg1, $0 > - zext.32 %r29 <- (1) %r26 > + setne.32 %r29 <- %arg1, $0 > ret.32 %r29 > > > diff --git a/validation/optim/setne0-zext.c b/validation/optim/setne0-zext.c > index fc6615bec..8a074f037 100644 > --- a/validation/optim/setne0-zext.c > +++ b/validation/optim/setne0-zext.c > @@ -3,7 +3,6 @@ unsigned long foo(int a) { return (unsigned int) (a != 0); } > /* > * check-name: setne0-zext > * check-command: test-linearize -m64 -Wno-decl $file > - * check-known-to-fail > * > * check-output-ignore > * check-output-excludes: zext\\. > diff --git a/validation/optim/trunc-seteq0.c b/validation/optim/trunc-seteq0.c > index 321c045e3..5994b17cd 100644 > --- a/validation/optim/trunc-seteq0.c > +++ b/validation/optim/trunc-seteq0.c > @@ -10,7 +10,6 @@ int ou(int i, struct S *b) { return i || b->u; } > /* > * check-name: trunc-seteq0 > * check-command: test-linearize -Wno-decl $file > - * check-known-to-fail > * > * check-output-ignore > * check-output-excludes: trunc\\. > -- 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