diff options
author | Björn Gustavsson <[email protected]> | 2019-04-05 12:42:27 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-04-05 13:21:00 +0200 |
commit | ef6d5f9e329a381ce25887c104b8aa560d3ff8ee (patch) | |
tree | 4bacc2f8b690a1d3e50aee4597f346b7c30212b3 /erts/emulator/beam | |
parent | c0989dcede812c47290f1c61d39e46caa0edf547 (diff) | |
download | otp-ef6d5f9e329a381ce25887c104b8aa560d3ff8ee.tar.gz otp-ef6d5f9e329a381ce25887c104b8aa560d3ff8ee.tar.bz2 otp-ef6d5f9e329a381ce25887c104b8aa560d3ff8ee.zip |
Optimize the i_minus instruction
Measurements show that i_minus instructions (subtraction) are
frequent enough to warrant creating specialized i_minus instructions.
Thanks to José Valim for doing instruction counting on
Elixir code.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/ops.tab | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab index 7a125b0f67..10ca74cd60 100644 --- a/erts/emulator/beam/ops.tab +++ b/erts/emulator/beam/ops.tab @@ -1690,9 +1690,14 @@ i_plus S1=c S2=c Fail Dst => move S1 x | i_plus x S2 Fail Dst i_plus xy xyc j? d -i_minus x x j? d -i_minus c x j? d -i_minus s s j? d +# A minus instruction with a constant right operand will be +# converted to an i_increment instruction, except in guards or +# when the negated value of the constant won't fit in a guard. +# Therefore, it very rare. +i_minus S1 S2=c Fail Dst => move S2 x | i_minus S1 x Fail Dst + +i_minus xy xy j? d +i_minus c xy j? d i_times j? s s d |