diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-07-06 00:12:40 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-07-23 13:11:20 +0200 |
| commit | bb97ff365b6f0cbcd8ee4057ee45925094d8101d (patch) | |
| tree | 0213c28daba8f52b7485624b7b159e5ff9fd2e68 /simplify.c | |
| parent | 7da1a1b5051e146fe6e67b1c30af6ef6516c81d0 (diff) | |
| download | sparse-dev-bb97ff365b6f0cbcd8ee4057ee45925094d8101d.tar.gz | |
cast: simplify SEXT(ZEXT(x,N),N')
A sign-extension following a zero-extension can always
be simplified into a single zero-extension since the
intermediate value is guaranted to have a zero sign bit.
Simplify away such instructions.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'simplify.c')
| -rw-r--r-- | simplify.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1080,6 +1080,9 @@ static int simplify_cast(struct instruction *insn) break; case OP_ZEXT: switch (insn->opcode) { + case OP_SEXT: + insn->opcode = OP_ZEXT; + /* fall through */ case OP_ZEXT: insn->orig_type = def->orig_type; return replace_pseudo(insn, &insn->src, def->src); |
