vnmakarov / mir

A lightweight JIT compiler based on MIR (Medium Internal Representation) and C11 JIT compiler and interpreter based on MIR
MIT License
2.29k stars 145 forks source link

Improve the compare family of insns on X86. #310

Closed remy-luisant closed 1 year ago

remy-luisant commented 1 year ago

My code is very heavy on the compare family of insns. They could use some better code generation on X86.

The added move after each is not needed, as we can put the result in the right place while we do the extend. Also we could get rid of the requirement to use AL as an intermediate register, freeing up RAX for other tasks.

Tests pass.

vnmakarov commented 1 year ago

Sorry for the delay with the reviewing this PR I was quite busy with other projects and still will be busy until May. So my responses can be slow until then.

I'd say your pull request is the most technically deep one I had so far for MIR-project. So I really appreciate your work. Optimizations are important and I'll work on improving them but there are also a lot of small details which are important for better code generation. That is what your PR about.

Thank you very much for the PR. Currently bbv branch is not in a good shape but I've merged your work into the branch.

remy-luisant commented 1 year ago

Thank you for the kind words. I have one more patch like this ready to go, I will be making a request for it within a few days. I also want to add an insn for byte swapping, since that is a real pain do to step by step.

When you have some time, could you let me know what needs to be done for the bbv branch to be ready to go? I do have some compiler knowledge, I'm happy to help. If you could point me to some tests that are failing, that would be best.

Another thought would be to merge this into the main branch, if bbv will be delayed a lot. I have no idea what your timelines look like.

Thank you, good luck with the other projects!