Opened 14 years ago

Closed 14 years ago

Last modified 13 months ago

#2069 closed defect (fixed)

MT32Emu does not compile with gcc4/fc4

Reported by: SF/awjb Owned by: eriktorbjorn
Priority: high Component: Audio: MT32
Keywords: Cc:


-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32
-march=i386 -mtune=pentium4
-fasynchronous-unwind-tables -DHAVE_CONFIG_H -DUNIX
-DDISABLE_SAGA -I. -I. -I./common
-I./backends/midi/mt32 -I/usr/include/SDL
-D_REENTRANT -Itest/cxxtest -c
backends/midi/mt32/i386.cpp -o backends/midi/mt32/i386.o
backends/midi/mt32/i386.cpp: In function 'float
MT32Emu::iir_filter_sse(float, float*, float*, int)':
backends/midi/mt32/i386.cpp:142: error: unknown
register name 'xmm3' in 'asm'
backends/midi/mt32/i386.cpp:142: error: unknown
register name 'xmm2' in 'asm'
backends/midi/mt32/i386.cpp:142: error: unknown
register name 'xmm1' in 'asm'

Ticket imported from: #1224138. Ticket imported from: bugs/2069.

Change History (8)

comment:1 by fingolfin, 14 years ago

Owner: set to kingguppy
Priority: normalhigh

comment:2 by fingolfin, 14 years ago

This seems related to bug #1221549 and apparently is due
to a problem with the inline assembler?

comment:3 by SF/awjb, 14 years ago

from my pov it is... I don't know asm well enough to
actually deal with the problem but thats what it looks
like... seems to be changes in gcc4 as other software has
asm issues with gcc4 as well (but get fixed so it is not a
gcc4 error).

comment:4 by eriktorbjorn, 14 years ago

I don't know much about assembly language either, but from
what I understand it's complaining about the list of
"clobbered" registers, which I assume are the ones that have
their values changed as a result of running that piece of code.

This file takes advantage of SSE and MMX instructions, if
the CPU it's running on has support for it. But apparently
GCC 4 does not recognize the SSE and MMX registers unless
told to.

If I add -msse to the command line when compiling this
particular file, I no longer get the compiler errors
described in the bug report. If I add -mno-mmx I get a set
of new errors, so I guess we should also add -mmmx. From
what I understand, these flags only tells GCC to recognize
SSE and MMX, not to generate such instructions on its own.
But I could be wrong about that.

Another way might be to change the code to make sure that
the registers aren't clobbered. That should just be a matter
of pushing them on the stack at the beginning and pulling
them off the stack at the end, wouldn't it? Or is MMX/SSE
too magic for such tricks?

comment:5 by eriktorbjorn, 14 years ago

Here's a post about how Red Hat handled a similar (I think)
problem in The GIMP:

I.e. surround the clobber lists with either #ifdef __SSE__
... #endif or #ifdef __MMX__ ... #endif. I guess the
reasoning is that if the compiler isn't going to generate
SSE or MMX instructions on its own, it doesn't need to know
whether or not these registers are clobbered. Debian appears
to use the same solution.

I don't have GCC 4 on this computer, but I'll look at it later.

comment:6 by eriktorbjorn, 14 years ago

I believe it's fixed in CVS now, but since I can't actually
run the MT-32 emulator (my computer is too slow, and I don't
have the necessary data files), I haven't tested it other
than by trying to compile it.

comment:7 by eriktorbjorn, 14 years ago

Owner: changed from kingguppy to eriktorbjorn
Resolution: fixed
Status: newclosed

comment:8 by digitall, 13 months ago

Component: Audio: MT32
Note: See TracTickets for help on using tickets.