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
powerpc: don't use asm optimisation with clang #210
Conversation
This allows MilkyTracker to be built with that compiler on this arch.
Building with GCC9 also fails (FreeBSD 12.1-RELEASE on powerpc64, base compiler is GCC 4.2.1):
|
Oh, it used to build with GCC-8.3 on OpenBSD/macppc. It looks like we're going straight into an #ifdef hell the way i'm proposing this :| |
@julianaito: GCC-8.3 on OpenBSD doesn't define The asm is in the wrong syntax. |
I'm in favour of removing these asm blocks and relying on the compiler to generate any optimisations. Could someone test that there are no performance bottlenecks if we do so? |
@Deltafire: I made a simple benchmark of fill_dword() and fill_dword_vertical() for my old G3 (PowerPC 750 at 400 MHz) running OpenBSD/macppc. The C code looks about as fast as the asm code. I needed to edit the asm code. I added some gcc 8.3.0 -O2 with len = 100, pitch = 32:
clang 8.0.1 -O2 with len = 100, pitch 32:
The compilers and the asm use different optimizations. Both gcc and clang use I removed |
I removed the PPC assembly code and replaced with the library function memset(), which should already by optimised for the target platforms. See commit ba5699e. |
@Deltafire, does memset() really work? As I understood it, fill_dword() fills in 32-bit values, but memset() fills in 8-bit values. |
OpenBSD and FreeBSD use clang to build MilkyTracker, and this compiler does not like the asm optimisations used for ppc32/64.
On OpenBSD/macppc (but it seems to be the same on FreeBSD/powerpc), this generates these errors:
Using
-fno-integrated-as
did not solve the issue, it emits relocations errors. I can't test every platform using clang on ppc32/64 so maybe it would need further OS-filtering, but i wanted more opinions before eventually polishing that PR, or using some different code if my proposal is considered a bad idea :)CC'ing @pkubaj if he's interested.