VOGONS


First post, by TeaRex

User metadata
Rank Member
Rank
Member

The following small patch makes it possible to compile DOSBox under GCC with link-time optimization without hitting compilation errors regarding duplicate labels, caused by including the FPU assembly code several times (for the several cores). It does that by using GCC's local label feature.

Of its own it doesn't enable -flto though, you have to do that yourself. If -flto is not enabled, it changes nothing. If it is enabled though, your DOSBox becomes noticeably faster, at least it does on my Core2Quad Linux system.

--- src/fpu/fpu_instructions_x86.h	(revision 3798)
+++ src/fpu/fpu_instructions_x86.h (working copy)
@@ -660,9 +660,9 @@
"fstpt (%2, %%eax) \n" \
"movw %0, %%ax \n" \
"sahf \n" \
- "jp argument_too_large1 \n" \
+ "jp 1f \n" \
"fstpt (%2, %1) \n" \
- "argument_too_large1: " \
+ "1: " \
: "=m" (new_sw) \
: "r" (TOP), "r" (fpu.p_regs) \
: "eax", "cc", "memory" \
@@ -686,9 +686,9 @@
"fstpt (%2, %%eax) \n" \
"movw %0, %%ax \n" \
"sahf \n" \
- "jp argument_too_large2 \n" \
+ "jp 1f \n" \
"fstpt (%2, %1) \n" \
- "argument_too_large2: " \
+ "1: " \
: "=m" (new_sw) \
: "r" (TOP), "r" (fpu.p_regs) \
: "eax", "cc", "memory" \

[/code]

tearex

Reply 1 of 7, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

are you sure that replacing it both times with 1: is correct ?
As that would give me the same label in both functions.

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 7, by Serious Callers Only

User metadata
Rank Member
Rank
Member

Is this going to get committed? It would be nice to have for my mt32 ppa build (if i can figure out if it can build separately and still flto optimization, since the mt32emu lib uses cmake).

(especially since ppa's enforce 64 bits installs for 64 bit OS, so dosbox is generally a bit slower for the dynarec core)

Reply 5 of 7, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

maybe, wondering why the original code doesn't work.
Is there some limit to the length of a label?

Water flows down the stream
How to ask questions the smart way!

Reply 7 of 7, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Thanks to some articles provided by rcblanke, I understand the issue a bit better. The patch makes sense.

Commited as revision 3799

Water flows down the stream
How to ask questions the smart way!