diff options
| -rw-r--r-- | simplify.c | 10 | ||||
| -rw-r--r-- | validation/optim/zext-asr.c | 13 |
2 files changed, 23 insertions, 0 deletions
@@ -606,6 +606,16 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v else if (value >= size) value = size - 1; goto new_value; + + case OP_ZEXT: + // transform: + // zext.N %t <- (O) %a + // asr.N %r <- %t, C + // into + // zext.N %t <- (O) %a + // lsr.N %r <- %t, C + insn->opcode = OP_LSR; + return REPEAT_CSE; } break; case OP_LSR: diff --git a/validation/optim/zext-asr.c b/validation/optim/zext-asr.c new file mode 100644 index 00000000..5f235ad8 --- /dev/null +++ b/validation/optim/zext-asr.c @@ -0,0 +1,13 @@ +unsigned short foo(unsigned short a) +{ + return a >> 16; +} + +/* + * check-name: zext-asr + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: ret\\..*\\$0 + * check-output-excludes: asr\\. + */ |
