Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Optimise common combinations of relational operators #6025

Merged
merged 3 commits into from
May 30, 2022

Conversation

bjorng
Copy link
Contributor

@bjorng bjorng commented May 27, 2022

Optimise the generated code for common combinations of relational operators such as in the following examples:

f(A) when is_integer(A), 0 =< A, A =< 1000 ->
    A + 1.

g(A) when 0 =< A, A =< 1000 ->
    A + 1.

@bjorng bjorng added team:VM Assigned to OTP team VM enhancement testing currently being tested, tag is used by OTP internal CI labels May 27, 2022
@bjorng bjorng requested review from garazdawi and jhogberg May 27, 2022 05:37
@bjorng bjorng self-assigned this May 27, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 27, 2022

CT Test Results

       4 files     367 suites   43m 49s ⏱️
2 009 tests 1 956 ✔️ 53 💤 0
5 573 runs  5 502 ✔️ 71 💤 0

Results for commit 439bdea.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

bjorng added 3 commits May 30, 2022 04:11
This is not an optimization in itself but it reduces the number
of permutations of adjacent relational operators and thus will
simplify instruction combination optimizations for the JIT.
The `cmp_arg()` helper would generate an unnecessary move to the
SUPER_TMP register if the RHS argument was an X register backed by a
CPU register. For example:

    mov x14, x27
    cmp x26, x14

This code can be simplified to:

    cmp x26, x27
Optimize the generation of native code for common combinations of
relational operators in guards.
@bjorng bjorng force-pushed the bjorn/jit/optimize-range-check branch from 439bdea to f8a9ccd Compare May 30, 2022 02:13
@bjorng bjorng merged commit 692a485 into erlang:master May 30, 2022
@bjorng bjorng deleted the bjorn/jit/optimize-range-check branch May 30, 2022 02:14
@itssundeep itssundeep mentioned this pull request Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants