After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 308412 - GCC 4.0 version in Fedora Core 4 can't handle the mmx code
GCC 4.0 version in Fedora Core 4 can't handle the mmx code
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other Linux
: Normal normal
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
: 309199 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-06-20 16:34 UTC by weskaggs
Modified: 2005-08-13 21:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure.in patch (341 bytes, patch)
2005-07-04 11:30 UTC, Theerud Lawtrakul
needs-work Details | Review
Patch to determine appropriate mmx and sse compiler flags (1.38 KB, patch)
2005-07-08 03:19 UTC, Kevin Cozens
none Details | Review
Correct version of patch to determine appropriate mmx and sse compiler flags (1.38 KB, patch)
2005-07-08 03:55 UTC, Kevin Cozens
needs-work Details | Review
Patch defines MMX_EXTRA_CFLAGS with -mmmx and -msse flags as appropriate (1.53 KB, patch)
2005-07-31 15:22 UTC, Kevin Cozens
none Details | Review

Description weskaggs 2005-06-20 16:34:56 UTC
Distribution/Version: Fedora Core 4

This bug report is about an issue that arose tangentially in bug #303796,
specifically in comment #9 there; comment #24 there describes the current state
of affairs.

Here is the problem:  If you try to build GIMP in FC4, with default
configuration, on an i386 system with mmx support, the build fails in
gimp-composite-mmx.c.  At the moment the workaround is to specify --disable-mmx
when configuring, which is obviously not an ideal solution.

Note that this problem does not arise on AMD64.
Comment 1 Sven Neumann 2005-06-30 11:00:09 UTC
*** Bug 309199 has been marked as a duplicate of this bug. ***
Comment 2 Theerud Lawtrakul 2005-07-04 11:08:58 UTC
Confirmed. Adding -mmmx and -msse into CFLAGS when enable MMX/SSE should fix this.
Comment 3 Theerud Lawtrakul 2005-07-04 11:30:26 UTC
Created attachment 48618 [details] [review]
configure.in patch

Proposed configure.in patch to add the required flags.
Comment 4 Manish Singh 2005-07-04 17:38:52 UTC
Is this really correct? Does adding those CFLAGS serve only to *allow* mmx/sse
assembly, or does it also cause gcc to generate mmx/sse instructions on its own?

If the latter, this is not acceptible, since use of these extensions need to be
selectable at runtime.
Comment 5 Theerud Lawtrakul 2005-07-05 06:48:18 UTC
From GCC manual about -mmmx and friends:

<quote>
These switches enable or disable the use of built-in functions that allow direct
access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the instruction set.

See X86 Built-in Functions, for details of the functions enabled and disabled by
these switches.

To have SSE/SSE2 instructions generated automatically from floating-point code,
see -mfpmath=sse.
</quote>

So I guess these options will only enable, and not generate mmx/sse instructions
automatically unless we explicitly use vector extensions or -mfpmath=sse.

It is strange that I do not need to specify the flags when building GIMP with
mmx/sse enabled under an older version of GCC. Is this actually a fix for the
flags behavior bug?
Comment 6 Manish Singh 2005-07-05 07:18:29 UTC
Comment #4 and #24 in bug #303796 claim otherwise.

At any rate, the configure.in patch needs work, since -mmmx and -msse aren't
available on all compilers, and it seems to ignore SSE2.

The same technique configure figures out which altivec switch to use can be
applied here.
Comment 7 Theerud Lawtrakul 2005-07-05 10:10:32 UTC
SSE2 uses xmm* registers, so -msse should be enough to fix the clobber lists
problem.

From the discussion, it seems that future GCC will not compile the current code
without -mmmx/-msse specified (need info from GCC folks). And simply have
-mmmx/-msse is not a good idea to build binaries that will run on any x86.
Should we just fix the code with #ifdef, or specify appropriate CFLAGS for
*each* of processor specific files? Either cases sound ugly to me.
Comment 8 weskaggs 2005-07-05 15:51:18 UTC
Removing NEEDINFO because it is not appropriate for this bug to be in "ignore"
mode, even if the correct fix is not yet clear.  Also confirming on the basis of
comment #2.

Comment 9 Kevin Cozens 2005-07-08 03:19:12 UTC
Created attachment 48809 [details] [review]
Patch to determine appropriate mmx and sse compiler flags

This patch will make configure determine which compiler flags should be used to
compile MMX/SSE code when appropriate. Only one set of flags are checked in
this patch. Flags for other compilers can be added as needed.
Comment 10 Kevin Cozens 2005-07-08 03:55:55 UTC
Created attachment 48811 [details] [review]
Correct version of patch to determine appropriate mmx and sse compiler flags

This is the correct version of the patch.
Comment 11 Sven Neumann 2005-07-13 15:21:56 UTC
This should be committed to both branches then.
Comment 12 Akkana Peck 2005-07-13 16:46:33 UTC
This isn't just a fedora issue -- it happens on debian sid as well (on an AMD
sempron 32). The patch fixes it.
Comment 13 Manish Singh 2005-07-13 17:15:27 UTC
Actually no, the flags should be limited to the composite dir, just like the
altivec ones are.

It'd be nice if the whole flag detection stuff stuff became an m4 macro too.
Comment 14 Ari Pollak 2005-07-14 23:49:52 UTC
Re: Comment #12, adding "-mmmx -msse" to CFLAGS causes an Illegal Instruction
error on gimp start on machines with MMX but no SSE, like early Athlons.
Comment 15 Ali Akcaagac 2005-07-18 10:36:06 UTC
Ahh, I was up to report a similar bugreport myself and then stepped over this
one. I got the same issues with "-mmmx -msse" using GCC 4.0.1 (and here it was
NOT FC4 so it's a general compiler specific thing), Applying the updated patch
from the attachment below solved the issues for me. Compiled went on correctly.

Just in case, wanted to add my feedback to it.
Comment 16 Kevin Cozens 2005-07-31 15:22:14 UTC
Created attachment 50017 [details] [review]
Patch defines MMX_EXTRA_CFLAGS with -mmmx and -msse flags as appropriate

Third time lucky? This patch checks whether the compiler understands the -mmmx
and -msse flags. This information is used to define MMX_EXTRA_CFLAGS. The
Makefile of the composite directory uses this new define.
Comment 17 Michael Schumacher 2005-07-31 19:28:40 UTC
It didn't break my Win32 build and made my Linux build work again - so there is
at least something right with it :)
Comment 18 Manish Singh 2005-07-31 19:36:17 UTC
I don't think this is good enough, since the CFLAGS may cause mmx/sse
instruction generation in any file in the composite directory, and some of those
are used unconditionally.

Better to apply the specific flag needed to only the files that actually use it.
Comment 19 Manish Singh 2005-08-01 05:31:45 UTC
I've done a fair bit of work in HEAD to only compile files with the actual
mmx/sse/etc. code using the respective CFLAGS. Let's see how it tests out there
before backporting it.
Comment 20 Manish Singh 2005-08-13 21:30:11 UTC
OK, backported to 2.2. Closing as FIXED.