Gentoo Archives: gentoo-user

From: Florian Philipp <f.philipp@××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Cannot compile texinfo: Illegal instruction -> Wrong -march and -mtune flags?
Date: Thu, 02 Aug 2007 22:14:47
Message-Id: 200708030007.53311.f.philipp@addcom.de
In Reply to: [gentoo-user] Re: Cannot compile texinfo: Illegal instruction -> Wrong -march and -mtune flags? by Alexander Skwar
1 Am Donnerstag 02 August 2007 23:36 schrieb Alexander Skwar:
2 > · Florian Philipp <f.philipp@××××××.de>:
3 > > You see, they are not compatible and even if some code works I wouldn't
4 > > bet multimedia apps will perform well.
5 > >
6 > > With -mtune the instruction set stays the same. It is just "rearranged".
7 >
8 > Hm. Allright. When using just -mtune (ie. without -march), the
9 > docs at
10 > http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/i386-and-x86_002d64-Options.htm
11 >l
12 >
13 > say:
14 > | While picking a specific cpu-type will schedule things appropriately
15 > | for that particular chip, the compiler will not generate any code that
16 > | does not run on the i386 without the -march=cpu-type option being used.
17 >
18 > If -mtune=athlon-xp is used, code is generated which may make
19 > use of 3dNOW!. 3dNOW! is, of course, not to be found on 386 :)
20 > If the instruction set stays the same, code generated with
21 > -mtune=athlon-xp would not be executable on 386 machines, if
22 > I understand you correctly.
23 >
24 > Hm. With -mtune, the set of available instructions (ie.
25 > stuff like 3dNOW!, I suppose?) is NOT changed from the default
26 > of i386, is it? Or what does "Tune to cpu-type everything applicable
27 > about the generated code, except for the ABI and the set of available
28 > instructions." mean - especially note the "except for [...] the set of
29 > available instructions" part.
30 >
31 > So with "-mtune=pentium-m -march=athlon-xp" I'm making the compiler
32 > generate code which is "ordered" the way it's best for pentium-m
33 > machines while allowing it to use athlon-xp instruction set? Is
34 > that what I'm doing?
35 >
36 > If so, then it seems you're right - code will run, but maybe not
37 > so well.
38 >
39 > Is that understanding correct? If so, then I really should think
40 > twice about using "-mtune=pentium-m -march=athlon-xp", shouldn't
41 > I?
42 >
43 > Curious,
44 >
45 > Alexander Skwar
46 > --
47
48 At least that's how I understand the issue. At the moment I've got two ideas
49 to solve your problem:
50
51 1. set march to an inferior target (pentium-3 and pentium-3m seem okay: mmx
52 and sse) and mtune for one (or even both?) of them
53 2. set march to one of them and disable incompatible instruction sets with
54 options like -mno-sse2 or -mno-3dnow

Replies