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:51:47 +0200 |
| commit | 5791d659d0db0468998decab7352efb8e8142cf9 (patch) | |
| tree | d7cd5042ee70d5338cb0fab1448d5c2302ed113d | |
| parent | 1a5e49c57e6585832c4197f4f2ed91c73a964cb9 (diff) | |
| download | sparse-dev-5791d659d0db0468998decab7352efb8e8142cf9.tar.gz | |
simplify SEXT(SETCC(x,y), N)
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@gmail.com>
| -rw-r--r-- | simplify.c | 4 | ||||
| -rw-r--r-- | validation/optim/setne0-sext.c | 1 |
2 files changed, 4 insertions, 1 deletions
@@ -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 565f8df2..4167979b 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\\. |
