-
Notifications
You must be signed in to change notification settings - Fork 271
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
Modified VU0MixVec. Corrected clobbers. #272
Conversation
Nice work @astrelsky ! I've tested with gcc3.2.3 and gcc11 toolchains:
The perlin noise seems to be mostly working, but there's still a '+' sign in the perlin noise that fades in and out. The c code for the same function does not show this artifact:
|
Hmm that is strange. I was testing with the function in a file by itself so I didn't notice there was still an issue. I'm working directly with opl now so I can check through calls to the function and ensure everything is flowing correctly. |
@rickgaiser It should be good now. It turns out that gcc was changing instructions when inlining it. Adding the Also, for the new toolchain, make sure It is also possible that inlining was the problem the whole time but I haven't bothered to check. |
Inlining should be possible. So it seems like there is another bug. I tested on gcc11, and your solution does work, but it's a workaround for the real problem right? Do you know what other instructions it's wrongfully mixing with, and why?
I've noticed, the hard way ;-). |
For readability the operands have also been changed to symbolic names. The noinline attribute is required for functionality on the new toolchain. It should have virtually no effect on the old toolchain.
It appears I was wrong, the old toolchain will inline functions. Just not as aggressively as newer versions of gcc. I previously had a situation where I used As for the fix here I was missing the "memory" clobber. Without it the compiler wasn't correctly preserving the value of one of the input pointers. |
I've tested using both the old and new toolchains. It's a real fix for the real bug, great! Merging. |
Modified VU0MixVec. Corrected clobbers.
Modified VU0MixVec. Corrected clobbers.
Pull Request checklist
Note: these are not necessarily requirements
Pull Request description
For readability the operands have also been changed to symbolic names. These changes were made primarily to enable functionality on both the old and new toolchains while using the same code.
Prior to these changes the following was produced by the old toolchain:
With these changes the following is produced by the old toolchain:
With these changes the following is produced by the new toolchain: