diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-07-31 00:24:17 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-06 08:53:09 +0200 |
| commit | bf7f95c1e8d806d844795e546bc4494b3e4858c6 (patch) | |
| tree | e5cb26ecd5e1ee1dbd05a03fcfff044b308232af | |
| parent | 5791d659d0db0468998decab7352efb8e8142cf9 (diff) | |
| download | sparse-dev-bf7f95c1e8d806d844795e546bc4494b3e4858c6.tar.gz | |
simplify TRUNC(SETCC(x,y), N)
Since the OP_SETCC instructions can only return a 0 or a 1,
a truncation won't change the value and the OP_SETCC
can be changed to directly return the extended size.
Remove the unneeded truncate.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | simplify.c | 2 | ||||
| -rw-r--r-- | validation/optim/setne0-trunc.c | 1 |
2 files changed, 2 insertions, 1 deletions
@@ -1196,11 +1196,13 @@ static int simplify_cast(struct instruction *insn) break; /* fall through */ case OP_ZEXT: + case OP_TRUNC: // simplify: // setcc.n %t <- %a, %b // zext.m %r <- (n) %t // into: // setcc.m %r <- %a, %b + // and same for s/zext/trunc/ insn->opcode = def->opcode; use_pseudo(insn, def->src2, &insn->src2); return replace_pseudo(insn, &insn->src1, def->src1); diff --git a/validation/optim/setne0-trunc.c b/validation/optim/setne0-trunc.c index 62131410..6c5494ec 100644 --- a/validation/optim/setne0-trunc.c +++ b/validation/optim/setne0-trunc.c @@ -3,7 +3,6 @@ char foo(int a) { return a != 0; } /* * check-name: setne0-trunc * check-command: test-linearize -m64 -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: trunc\\. |
