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

Extra movsd's and some odd choice of register(s) #7

Open
Zueuk opened this issue Feb 28, 2016 · 3 comments
Open

Extra movsd's and some odd choice of register(s) #7

Zueuk opened this issue Feb 28, 2016 · 3 comments
Labels

Comments

@Zueuk
Copy link
Contributor

Zueuk commented Feb 28, 2016

I noticed that the generated asm code loads the same value into the same register multiple times.
The old Mathpresso (with an old AsmJit) version that I used before didn't do this:

x = y =1

lea rax, [L2]
movsd xmm0, [rax]
movsd [rdx], xmm0
movsd xmm0, [rax]
movsd [rdx+8], xmm0
movsd xmm0, [rax]
movsd [rcx], xmm0
ret

Another thing - a combination of an unary operation ("-", sqrt, etc.) and a function call somehow makes it use xmm6, that apparently needs to be savied/restored:

-x / sin(y)

sub rsp, 72
movaps oword ptr [rsp+48], xmm6
xorpd xmm6, xmm6
subsd xmm6, [rdx]
...
movaps xmm6, oword ptr [rsp+48]
add rsp, 72
ret

@kobalicek
Copy link
Owner

The best would be to have an implementation of all trigo functions inlinable, and this can be addressed in MathPresso as well. I'm planning to address the multiple fetches of constants in MPSL, I'm not sure if it is worth the effort to address it in MathPresso as it doesn't have IR (MSPL has).

@kobalicek
Copy link
Owner

I'm marking this as wontfix, as this will be fixed in more advanced MPSL project. After MPSL is ready there will be an expression mode so it can replace mathpresso completely.

@kobalicek
Copy link
Owner

Unnecessary MOVs will be also fixed by new asmjit's register allocator that can perform register coalescing, so no need to fix this in MathPresso.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants