-
Notifications
You must be signed in to change notification settings - Fork 10
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
Shifts and rotates - count operand extending #206
Comments
if you solve this properly you also have to consider cases without
Thus you have to handle cases where there are instructions inbetween the It can be done, just needs time... |
yeah, there it is. Now, the question is, do we need this: |
please test, this http://franke.ms/cex/z/qGfbec looks ok now. |
Yeah, on this example it looks great. However, the same should apply also to shifts right and it doesn't yet (unless this was just a proof of concept to see if you are on right track). BTW: What I have also noticed is that gcc does not emit other LSL/LSR sizes as long. E.g. following code
will be compiled to
where |
available in ~36 mins |
The used instructions do not contain shifts for shorter modes. Maybe that can be added, but I'm not sure about this... |
well, the main problem is, that C/C++ converts everything to int before the shift gets applied.
|
please test: http://franke.ms/cex/z/4Teznb |
Looks great for me! Thanks! I've also checked ROL/ROR and they seem to behave correctly too. |
This is actually not related to Your changes to gcc, this is a generic gcc issue when generating m68k code. In case of shifts and rotations where count is given by register, gcc always extends the count to 32-bit operand, generating unnecessary code. The shift/rotate count is always taken modulo 64 so it does not matter if it is specified as 8, 16 or 32-bit variable.
What we have now is following:
compiled with
-Os -fomit-frame-pointer -m68020 -mregparm=2
gives:both
extb.l d1
andext.l d1
are unnecessary. Expected result would be:The same issue applies for all rotate/shift operations and gcc adds unnecessary signed/unsigned extension to long in all cases.
The text was updated successfully, but these errors were encountered: