diff options
author | Björn Gustavsson <[email protected]> | 2019-03-15 07:47:39 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-03-19 16:02:00 +0100 |
commit | ffa22bf1013c7dfeeb7bbf846983dfe39deb7e52 (patch) | |
tree | 8f8001b603c275f73f67550ab4bee977bd0422da /erts/emulator/beam/beam_load.c | |
parent | f55bb58c78ca3f82e89d0571b7b9541b983d2333 (diff) | |
download | otp-ffa22bf1013c7dfeeb7bbf846983dfe39deb7e52.tar.gz otp-ffa22bf1013c7dfeeb7bbf846983dfe39deb7e52.tar.bz2 otp-ffa22bf1013c7dfeeb7bbf846983dfe39deb7e52.zip |
Optimize some common uses of '+' and '-'
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r-- | erts/emulator/beam/beam_load.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index 5961b7d743..c2a54c85ce 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -3679,6 +3679,24 @@ gen_increment_from_minus(LoaderState* stp, GenOpArg Reg, return op; } +static GenOp* +gen_plus_from_minus(LoaderState* stp, GenOpArg Fail, GenOpArg Live, + GenOpArg Src, GenOpArg Integer, GenOpArg Dst) +{ + GenOp* op; + + NEW_GENOP(stp, op); + GENOP_NAME_ARITY(op, gen_plus, 5); + op->next = NULL; + op->a[0] = Fail; + op->a[1] = Live; + op->a[2] = Src; + op->a[3].type = TAG_i; + op->a[3].val = -Integer.val; + op->a[4] = Dst; + return op; +} + /* * Test whether the negation of the given number is small. */ |