3dnow, mmx, k6-2 optimizing?

Puna Tannehill puna at imagescape.com
Fri Sep 17 08:26:52 PDT 2004

Interesting.  I just tried the settings you suggested, and it seems 
that -mcpu is depreciated for -mtune.  ALWAYS check the documentation 
first.  :-)  Here's the details:



Puna Tannehill wrote:
> James Green wrote:
>> Hi Puna,
>> I had a k6-2 a few years back (before discovering BSD :) and did a lot
>> of Linux From Scratch work on it. I found that passing -march=i586
>> -mcpu=i686 produced by far the best results for pretty much any C/C++
>> code. Of course the code produced will not run on anything but a k6-2,
>> which as I understand it is a 686 core with 586 interface/timings, and
>> likewise if memory serves specifying only -march=i586 or -march=i686
>> (implying -mcpu=i586 or -mcpu=i686 respectively) won't run on the k6-2
>> either. Definitely a trade off between speed and (total lack of)
>> portablility. Again that was gcc-2.9x days...
> Interesting.  Was there an option for -march=k6-2 at that time?  Were
> the results based on a comparison of that setting and the ones you
> mention above?
> Do you happen to know if there is a particular benchmarking program that 
> might be useful to testing different compiles in FreeBSD?
> I've also seen recommendations using '586/mmx' and 'k7', but it seems
> interesting that someone would create a 'k6-2' flag if there were not
> significant and benefitial optimizations that would be applied.  Of
> course, whether anyone coded for that particular processor is probably
> extemely rare, so I can see how the -march -mcpu combination you
> suggested would probably be a better choice.
> Here are the relavent bits from dmesg (Compaq Presario 1692):
>     CPU: AMD-K6(tm) 3D processor (432.98-MHz 586-class CPU)
>       Origin = "AuthenticAMD"  Id = 0x58c  Stepping = 12
>       Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX>
>       AMD Features=0x80000800<SYSCALL,3DNow!>
>     K6-family MTRR support enabled (2 registers)
>> As far as ports such as Xorg/Xfree86, I am not entirely clear on CFLAGS
>> inheritance, but AFAIK Xorg/Xfree don't gain much/anything from
>> optimisation over than your usual -O2 and friends. I understand that
>> this is down to whether they have been written to make use of these cpu
>> functions/optimisations.
>> On the other hand though, it is the specific applications that run under
>> X, such as mplayer that tend to be written to make use of mmx, sse,
>> 3dnow etc. because for graphics it makes a _big_ difference. Generally
>> you find toggles in the Makefile to enable/force certain optimisation.
>> Definitely worth looking at.
> According to the latest GCC, you can use -m3dnow -mmmx and it is of
> some benefit when comiling XF86 (and hopefully Xorg).  I can't find the 
> page offhand, but it was in the GCC Documentation, and I posted it in 
> other responses of this same thread.  I haven't been
> able to test it yet, as I'm still compiling Xorg as we speak.
> Puna
>> On Mon, 2004-09-13 at 17:07, Puna Tannehill wrote:
>>> I've been looking for possible flags, optimizations, really anything 
>>> that would help me setup my laptop to use mmx and 3dnow.  I've 
>>> updated /etc/make.conf to -march to the drum of a k6-2, but I'm not 
>>> even sure if mmx and 3dnow are being taken into consideration for 
>>> compiling and such, especially for Xorg.
>>> I did some googling and found people who used CFLAGS like -mmmx and 
>>> -m3dnow, but when I run with those options, they fail and said to be 
>>> invalid.  they don't appear in 'man gcc' which should have been the 
>>> first place i looked.  I'm not finding anything in terms of compiling 
>>> or configuring Xorg to use 3dnow or mmx, or even how to check to see 
>>> if they are automatically detected and used.
>>> Any thoughts?
>>> Puna
>>> _______________________________________________
>>> freebsd-mobile at freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-mobile
>>> To unsubscribe, send any mail to 
>>> "freebsd-mobile-unsubscribe at freebsd.org"

More information about the freebsd-questions mailing list