-
Notifications
You must be signed in to change notification settings - Fork 37
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
mulsw macro change issue #13
Comments
I'm not sure what the error is here either. However, it's totally fine if you just keep using the old implementation. |
the new code is buggy:
consider
the compiler has to sign extend the short to int which is done with The old version had an internal int variable |
…es only to short^^
Bebbo, that update still breaks AmigaKlang - the original macro (before Bartman's recent change) works ok though. Antiriad. |
I've decided for now to settle on using two different versions of each so you can avoid the ext.l when you know it isn't necessary.
|
btw: with gcc there is no need for inline asm:
yields
so just create inline versions with C code and you are fine. |
I just tried that and at least in my case it doesn't work. |
maybe you could provide some minimal code to reproduce that issue? Maybe even here? https://franke.ms/cex/z/7aMKh4 |
It's happening with this simple example: What's confusing is that it goes away if you remove -m68000. |
Yes, I wrote in the README it 'sometimes' uses __mulsi3, because it really depends on the inlining and LTO stuff. We couldn't find clear patterns.. |
hm... https://franke.ms/cex/z/5xeGnc |
Hi,
I'm helping out Virgill with his Amigaklang exe generator which uses your cool gcc environment.
I updated his project from gcc8 to the gcc10 version and it stopped working (corrupt sounds). I have traced it to a commit on the 18th may where the mulsw and other macros were improved. If I leave the gcc10 in place but use the old mulsw macros it works OK again.
I had a look a the macros but the gcc/asm syntax is new to me so I couldn't spot any errors.
Virgill calls mulsw in two places as follows, maybe the error will be obvious to you:
short osc_sine (BYTE instance, short freq, UBYTE gain){ int temp; short res;static short counter[16]; short buf = counter[instance]+=freq; buf -= 16384; temp= mulsw(buf, 32767-abs(buf)); res =temp>>16; res<<=3; return vol(res,gain); }
inline short vol(short val, UBYTE gain){ return mulsw(val, gain) >> 7; }
You can message me here or on EAB if you need me to check/change something.
Cheers
Antiriad
The text was updated successfully, but these errors were encountered: