Re: Compiler Flags problem with core2 CPU

2010-03-03 Thread Aaron Lewis

[r...@meilk /usr/src/sys/i386/compile/AARON]# make
CC='cc' make -f ../../../dev/aic7xxx/aicasm/Makefile 
MAKESRCPATH=../../../dev/aic7xxx/aicasm
Warning: Object directory not changed from original 
/usr/src/sys/i386/compile/AARON
cc -O2 -pipe -march=i686 -ffast-math -mfpmath=sse -O3  -nostdinc 
-I/usr/include -I. -I../../../dev/aic7xxx/aicasm -std=gnu99 
-fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W 
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes 
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch 
-Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline 
-Wnested-externs -Wredundant-decls -Wno-pointer-sign -c 
../../../dev/aic7xxx/aicasm/aicasm.c

cc1: warnings being treated as errors
../../../dev/aic7xxx/aicasm/aicasm.c:1: warning: SSE instruction set 
disabled, using 387 arithmetics

*** Error code 1


It's interesting something can work with SSE instruction , while some 
are not ,


Warnings are treated as errors , if we can safely disable it in some 
specific occasions.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-03-03 Thread Giorgos Keramidas
On Tue, 2 Mar 2010 23:26:20 +0200, Dan Naumov dan.nau...@gmail.com wrote:
See the section 3.17.14 Intel 386 and AMD x86-64 Options in the gcc
Info manual.  It contains a full list of the supported CPU-TYPE values
for the -mtune=CPU-TYPE option.  The -march=CPU-TYPE option accepts the
same CPU types:

`-march=CPU-TYPE'
 Generate instructions for the machine type CPU-TYPE.  The
 choices for CPU-TYPE are the same as for `-mtune'.  Moreover,
 specifying `-march=CPU-TYPE' implies `-mtune=CPU-TYPE'.

 Hello
 Out of curiosity, what is the optimal -march= value to use for the
 new Atom D510 CPU: http://ark.intel.com/Product.aspx?id=43098 ?

I'm not sure.  'nocona' seems a pretty close match:

_nocona_
  Improved version of Intel Pentium4 CPU with 64-bit
  extensions, MMX, SSE, SSE2 and SSE3 instruction set
  support.

Without actually trying -march=nocona on one of these I can't
tell for sure if it is 'optimal' or not though.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-03-03 Thread Chuck Swiger

Aaron Lewis wrote:

[r...@meilk /usr/src/sys/i386/compile/AARON]# make
CC='cc' make -f ../../../dev/aic7xxx/aicasm/Makefile 
MAKESRCPATH=../../../dev/aic7xxx/aicasm
Warning: Object directory not changed from original 
/usr/src/sys/i386/compile/AARON

cc -O2 -pipe -march=i686 -ffast-math -mfpmath=sse -O3

[ ... ]

cc1: warnings being treated as errors
../../../dev/aic7xxx/aicasm/aicasm.c:1: warning: SSE instruction set 
disabled, using 387 arithmetics

*** Error code 1


It's interesting something can work with SSE instruction , while some 
are not , Warnings are treated as errors , if we can safely disable it in some 
specific occasions.


Dude, the FreeBSD kernel doesn't use floating point, MMX, or SSE.  See 
sys/conf/kern.mk:


# [ ... ]  Explicitly prohibit the use of SSE and other SIMD
# operations inside the kernel itself.  These operations are exclusively
# reserved for user applications.
#
.if ${MACHINE_ARCH} == i386  ${CC} != icc
CFLAGS+=-mno-align-long-strings -mpreferred-stack-boundary=2 \
-mno-mmx -mno-3dnow -mno-sse -mno-sse2
INLINE_LIMIT?=  8000
.endif

Trying to override the default compiler flags to force it to use SSE is simply 
not going to work.


--
-Chuck
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


[SOLVED] Compiler Flags problem with core2 CPU

2010-03-02 Thread Aaron Lewis

James Phillips wrote:
I laughed at your question because I remember reading somewhere that using aggressive optimization options is a good way to find compiler bugs. I think that extends of optimizations for new CPU architectures as well. 
I also heard kernel code avoids MMX instructions for some reason: it may have to do with interrupt handling (fewer registers=faster?). x86 (and AMD64) processors are backwards compatible, so you don't strictly need the latest instructions.


Regards,

James Phillips
Ah , i've just read it may not be safe to use MMX and SSE instructions 
in kernel code.

So my CFLAGS is much too agressive , i'll notice this.

Thank you all.

--

Best Regards,
Aaron Lewis - PGP: 0xA476D2E9
irc: A4r0n on freenode

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-03-02 Thread Giorgos Keramidas
On Sun, 28 Feb 2010 20:38:45 +0800, Aaron Lewis aaron.lewis1...@gmail.com 
wrote:
 Hi,
I gonna recompile kernel for my core2 CPU , so i'd like to pass some
 flags to gcc.
Kinds of -march=core2 , i tried to modify /etc/make.conf
e.gCFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse
But it fails .. bad arch switch , core2 cpu is not supported ?

And is that useful to let gcc select cpu specified asm code ?

See the section 3.17.14 Intel 386 and AMD x86-64 Options in the gcc
Info manual.  It contains a full list of the supported CPU-TYPE values
for the -mtune=CPU-TYPE option.  The -march=CPU-TYPE option accepts the
same CPU types:

`-march=CPU-TYPE'
 Generate instructions for the machine type CPU-TYPE.  The
 choices for CPU-TYPE are the same as for `-mtune'.  Moreover,
 specifying `-march=CPU-TYPE' implies `-mtune=CPU-TYPE'.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-03-02 Thread Giorgos Keramidas
On Sun, 28 Feb 2010 22:37:27 +0800, Aaron Lewis aaron.lewis1...@gmail.com 
wrote:
Paul B Mahol wrote:
On 2/28/10, Aaron Lewis aaron.lewis1...@gmail.com wrote:
 Hi,
 I gonna recompile kernel for my core2 CPU , so i'd like to pass some
 flags to gcc.  Kinds of -march=core2 , i tried to modify
 /etc/make.conf

 e.gCFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse
 But it fails .. bad arch switch , core2 cpu is not supported ?

 It is bad idea to compile kernel with custom flags. And gcc in FreeBSD
 doesn't know about core2,
 use 'native' if you must.


 And is that useful to let gcc select cpu specified asm code ?

 Only for some userland stuff like openssl.

 Really ? It's bad to use custom flags to compile kernel , why do you
 think so ?  I'd like to know more about this : )

 So setting optimize compiler flags is only useful for userland stuff ?

Please do not post your reply on *top* of the original text to this
list.  The preferred form of replying is bottom-posting here (other
lists may have their own rules, but that's ok).  I've fixed this message
manually, but it would be nice if you posted your reply to the bottom of
the quoted text.

You can definitely *try* using optimizations for the kernel too.  The
FreeBSD developers and other users cannot _force_ you to use only a very
limited set of options.  You are more than free to try new things.  This
is precisely the reason why we make the source tree available to
everyone, including detailed instructions for rebuilding the entire
system from source.

Note that the kernel is a very special program that may or may not work
with some of the optimizations performed by higher GCC levels, though.
There may be problems, so if you start building optimized kernels please
make sure you keep a 'safe' backup copy of /boot/kernel before you
install a new one.  This way you will at least be able to boot into the
old kernel if anything breaks.

One way to keep a backup copy of the kernel is to make sure your /boot
partition has enough free space and type as root:

# cp -a /boot/kernel /boot/kernel.safe

Then if anything goes wrong, you can always break into the loader prompt
and type:

boot unload

boot set module_path=/boot/kernel.safe;/boot/modules

boot load kernel

boot boot -s

Note that any optimization levels higher than the defaults are not
'supported' by the FreeBSD team though.  As the warning in make.conf
says [/usr/share/examples/etc/make.conf]:

  # CFLAGS controls the compiler settings used when compiling C code.
  # Note that optimization settings other than -O and -O2 are not recommended
  # or supported for compiling the world or the kernel - please revert any
  # nonstandard optimization settings to -O or -O2 -fno-strict-aliasing
  # before submitting bug reports without patches to the developers.

So if you start building highly-optimized kernels and userland binaries,
you are on your own.  Bumping in any problem will require that you
revert to the standard optimization flags, rebuild everything, try to
reproduce the problem again and *then* report it.

- Giorgos

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: Compiler Flags problem with core2 CPU

2010-03-02 Thread Dan Naumov
See the section 3.17.14 Intel 386 and AMD x86-64 Options in the gcc
Info manual.  It contains a full list of the supported CPU-TYPE values
for the -mtune=CPU-TYPE option.  The -march=CPU-TYPE option accepts the
same CPU types:

`-march=CPU-TYPE'
 Generate instructions for the machine type CPU-TYPE.  The
 choices for CPU-TYPE are the same as for `-mtune'.  Moreover,
 specifying `-march=CPU-TYPE' implies `-mtune=CPU-TYPE'.


Hello

Out of curiosity, what is the optimal -march= value to use for the
new Atom D510 CPU: http://ark.intel.com/Product.aspx?id=43098 ?

Thanks


- Sincerely,
Dan Naumov
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-03-02 Thread ill...@gmail.com
On 28 February 2010 07:38, Aaron Lewis aaron.lewis1...@gmail.com wrote:
 Hi,
   I gonna recompile kernel for my core2 CPU , so i'd like to pass some flags
 to gcc.
   Kinds of -march=core2 , i tried to modify /etc/make.conf
     e.g    CFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse
   But it fails .. bad arch switch , core2 cpu is not supported ?

Just so you know -O20 is the same as saying -O3.

I don't think everything in base is safe for -ffast-math,
but setting it in make.conf will surely test that.

-O2 is already turned on almost everywhere by default,
so also, I believe, with -fomit-frame-pointer.  The only
thing I've ever found to be remotely useful to change
was -Os on an old, space-restricted machine.  But
last time I tried -Os on amd64 it broke.  Badly.

-- 
--
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-03-01 Thread James Phillips


 Date: Sun, 28 Feb 2010 22:37:27 +0800
 From: Aaron Lewis aaron.lewis1...@gmail.com
 Subject: Re: Compiler Flags problem with core2 CPU
 To: Paul B Mahol one...@gmail.com
 Cc: freebsd-questions@freebsd.org
 Message-ID: 4b8a7fa7.1070...@gmail.com
 Content-Type: text/plain; charset=ISO-8859-1;
 format=flowed
 
 Really ? It's bad to use custom flags to compile kernel ,
 why do you 
 think so ?
 I'd like to know more about this : )
 
 So setting optimize compiler flags is only useful for
 userland stuff ?
 
I laughed at your question because I remember reading somewhere that using 
aggressive optimization options is a good way to find compiler bugs. I think 
that extends of optimizations for new CPU architectures as well. 
I also heard kernel code avoids MMX instructions for some reason: it may have 
to do with interrupt handling (fewer registers=faster?). x86 (and AMD64) 
processors are backwards compatible, so you don't strictly need the latest 
instructions.

Regards,

James Phillips






  __
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  
Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Compiler Flags problem with core2 CPU

2010-02-28 Thread Aaron Lewis

Hi,
   I gonna recompile kernel for my core2 CPU , so i'd like to pass some 
flags to gcc.

   Kinds of -march=core2 , i tried to modify /etc/make.conf
  
   e.gCFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse

   But it fails .. bad arch switch , core2 cpu is not supported ?

   And is that useful to let gcc select cpu specified asm code ?

--
Best Regards,
Aaron Lewis - PGP: 0xA476D2E9
irc: A4r0n on freenode

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-02-28 Thread Paul B Mahol
On 2/28/10, Aaron Lewis aaron.lewis1...@gmail.com wrote:
 Hi,
 I gonna recompile kernel for my core2 CPU , so i'd like to pass some
 flags to gcc.
 Kinds of -march=core2 , i tried to modify /etc/make.conf

 e.gCFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse
 But it fails .. bad arch switch , core2 cpu is not supported ?
It is bad idea to compile kernel with custom flags. And gcc in FreeBSD
doesn't know about core2,
use 'native' if you must.


 And is that useful to let gcc select cpu specified asm code ?

Only for some userland stuff like openssl.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-02-28 Thread Aaron Lewis
Really ? It's bad to use custom flags to compile kernel , why do you 
think so ?

I'd like to know more about this : )

So setting optimize compiler flags is only useful for userland stuff ?

Paul B Mahol wrote:

On 2/28/10, Aaron Lewis aaron.lewis1...@gmail.com wrote:
  

Hi,
I gonna recompile kernel for my core2 CPU , so i'd like to pass some
flags to gcc.
Kinds of -march=core2 , i tried to modify /etc/make.conf

e.gCFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse
But it fails .. bad arch switch , core2 cpu is not supported ?


It is bad idea to compile kernel with custom flags. And gcc in FreeBSD
doesn't know about core2,
use 'native' if you must.

  

And is that useful to let gcc select cpu specified asm code ?



Only for some userland stuff like openssl.
  



--
Best Regards,
Aaron Lewis - PGP: 0xA476D2E9
irc: A4r0n on freenode

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Compiler Flags problem with core2 CPU

2010-02-28 Thread Paul B Mahol
Do not top post.

On 2/28/10, Aaron Lewis aaron.lewis1...@gmail.com wrote:
 Really ? It's bad to use custom flags to compile kernel , why do you
 think so ?
 I'd like to know more about this : )

Use google.

 So setting optimize compiler flags is only useful for userland stuff ?

 Paul B Mahol wrote:
 On 2/28/10, Aaron Lewis aaron.lewis1...@gmail.com wrote:

 Hi,
 I gonna recompile kernel for my core2 CPU , so i'd like to pass some
 flags to gcc.
 Kinds of -march=core2 , i tried to modify /etc/make.conf

 e.gCFLAGS += -march=core2 -O20 -ffast-math -mfpmath=sse
 But it fails .. bad arch switch , core2 cpu is not supported ?

 It is bad idea to compile kernel with custom flags. And gcc in FreeBSD
 doesn't know about core2,
 use 'native' if you must.


 And is that useful to let gcc select cpu specified asm code ?


 Only for some userland stuff like openssl.



 --
 Best Regards,
 Aaron Lewis - PGP: 0xA476D2E9
 irc: A4r0n on freenode


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org