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

Shr_Un, Div_Un, Rem_Un leave behind a mess of flag updates. #45

Open
ElektroKill opened this issue Jan 16, 2022 · 1 comment
Open

Shr_Un, Div_Un, Rem_Un leave behind a mess of flag updates. #45

ElektroKill opened this issue Jan 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ElektroKill
Copy link
Contributor

Describe the bug
OldRod currently recompiles all REM, SHR, and DIV instructions to the CIL *_Un variants. This works well enough when Shr, Div, and Rem are virtualized since KoiVM doesn't emit any additional code for them. However, if Shr_Un, Div_Un, or Rem_Un are virtualized KoiVM emits a store to the FL register to set the UNSIGNED flag. When this occurs OldRod does not properly handle this flag and rather messy code is produced.

To Reproduce
Devirtualize the same sample file from issue #44.

Expected behavior
OldRod should recompile REM, SHR, and DIV instructions to the regular CIL variants (Rem, Shr, Div). If the UNSIGNED flag is set in FL register before the operation the instructions should be recompiled to the *_Un variants.

Screenshots
image
image
image

@ElektroKill ElektroKill added the bug Something isn't working label Jan 16, 2022
@ElektroKill ElektroKill changed the title Shr_Un, Div_Un, Rem_Un leave behind a mess of flag updates. Shr_Un, Div_Un, Rem_Un leave behind a mess of flag updates. Jan 16, 2022
@Washi1337
Copy link
Owner

Note: This will most likely require the addition of extra edges in the DFG to link instructions to others that update the flags register.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants