Hi Max!

Thanks for the patch! 

I believe it should bear a ‘cherry picked from’ label, isn’t it?

Otherwise LGTM.

Sergos



On 22 Aug 2022, at 12:40, Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> wrote:

Hi, Maxim!

Thanks for the patch!
LGTM.

On 19.08.22, Maxim Kokryashkin wrote:
This patch changes 'math_unary', `math_htrig` and `math_atrig`
to `math_call` for math functions compilation. Now all of
math functions in IRs are called with `CALLN` instead of
`FPMATH` (`ATAN2` for `math.atan2`).

The `ATAN2` instruction itself is removed, as well as the fold
optimization for it.

Also, this patch adds new fold optimizations for `CALLN`.

Part of tarantool/tarantool#7230
---
As we decided offline, no tests are provided with this patch, because
of their extreme complexity with no real benefits.

Branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-7230-cleanup-math-inconsistencies
PR: https://github.com/tarantool/tarantool/pull/7586

src/lib_math.c      | 22 +++++++++++-----------
src/lj_asm.c        |  6 ------
src/lj_asm_arm.h    |  1 -
src/lj_asm_arm64.h  |  1 -
src/lj_asm_x86.h    |  2 --
src/lj_ffrecord.c   | 19 ++-----------------
src/lj_ir.h         |  4 +---
src/lj_ircall.h     | 14 +++++++++-----
src/lj_opt_fold.c   | 25 ++++++++++++++++++++++++-
src/lj_opt_split.c  |  3 ---
src/lj_target_x86.h |  6 ------
src/lj_vmmath.c     |  6 ------
12 files changed, 47 insertions(+), 62 deletions(-)


<snipped>

-- 
2.36.1


-- 
Best regards,
Sergey Kaplun