i386/148926: make gcc generate i486 code by default

Yuri Karaban tech at askold.net
Sun Jul 25 12:30:10 UTC 2010


>Number:         148926
>Category:       i386
>Synopsis:       make gcc generate i486 code by default
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 25 12:30:10 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Yuri Karaban
>Release:        8.1-RELEASE
>Organization:
>Environment:
>Description:
Since FreeBSD does not support a 80386 processor, and minimum supported system is i486 it is good idea to enable i486 code generation by default.

Standard C++ library (libstdc++) can benefit from this change. The library uses atomic operation for thread safety. Function which perform atomic operation may be either synthesized as inline functions in case if synthesized operations are supported, and as library functions (like __gnu_cxx::__exchange_and_add) otherwise.

The problem that libstdc++ ensures that synthesized operations are supported by compiler with default options and disable support if not. It is logical decision, because libstdc++ must be usable whenever source compiled with explicit -march or not.

Since FreeBSD gcc producing i386 code by default, libstdc++ can't use synthesized operations (because for example atomic exchange and add instruction "xadd" is not supported on i386).

So I think enabling i486 code generation by default, and enabling atomic builtins in libstdc++ can give good performance boost, because locking operation in libstdc++ is used extensively.

Default options for gcc is located in configargs.h, which is generated by /usr/src/gnu/usr.bin/cc/cc_tools/Makefile.

And can me changed like:

--- Makefile.orig
+++ Makefile
@@ -321,7 +321,7 @@
 	echo 'static const struct {'				>> ${.TARGET}
 	echo '	const char *name, *value;'			>> ${.TARGET}
 	echo '} configure_default_options[] = {'		>> ${.TARGET}
-	echo '	{ "NULL", "NULL" } };'				>> ${.TARGET}
+	echo '	{ "arch", "i486" } };'				>> ${.TARGET}
 
 GENSRCS+=	configargs.h
 
(of course this change must be applied only on i386 architecture)
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list