Bug 154364

Summary: lang/gcc45: generate i486 code by default for i386 architecture
Product: Ports & Packages Reporter: Yuri Karaban <tech>
Component: Individual Port(s)Assignee: Gerald Pfeifer <gerald>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
gcc45-i386-default-arch-and-cpu.diff none

Description Yuri Karaban 2011-01-29 00:10:09 UTC
Since genuine 80386 machines is officially not supported by FreeBSD. It is safe to enable generation of i486 code by default.

This needed to enable atomic built-ins, which greatly speed up concurrent code. In standard C++ library std::string, using locking extensively and atomic built-ins will give noticeable speedup.

Needless to say, granting to use i486 instructions by default will speed up some programs which does not explicitly set -march.

I opened similar bug report (gnu/148926) regarding system gcc. The problem were solved by enabling some defines in c++config.h related to atomic builtins (since system gcc already generates i486 code by default).

Adding -with-arch=i486 to configure options is sufficient for lang/gcc45. The gcc will generate i486 code by default and libstdc++ shipped with it will be auto-configured to use atomic built-ins without need to edit c++config.h manually.

I'm attaching the patch which adds -with-arch=i486 for i386 architecture.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-01-29 00:10:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gerald

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Yuri Karaban 2011-01-29 23:29:26 UTC
The "-mcpu" value i386 looks very unreasonable even for "-arch=i386"
since most machines are not actually 80386.

I updated my patch to add "--with-cpu=generic" to optimize code for
common CPUs. I didn't use "--with-tune=generic" and used "--with-cpu"
instead intentionally, to override "cpu" option present in
BUILD_ROOT/gcc/configargs.h.
Comment 3 gerald 2011-01-30 01:28:15 UTC
Tijl and me are trying to get this addressed upstream.

Gerald
Comment 4 dfilter service freebsd_committer freebsd_triage 2011-02-22 18:56:57 UTC
gerald      2011-02-22 18:56:53 UTC

  FreeBSD ports repository

  Modified files:
    lang/gcc46           Makefile distinfo pkg-plist 
  Log:
  Update to the 20110219 snapshot of GCC 4.6.0.
  
  This addresses the pollution of common namespace by
  share/python/aotcompile.py and share/python/classfile.py which now
  go into version-specific directories.
  
  By means of an extra patch default code generation on i386 defaults
  to i486 on FreeBSD 6 and above. [1]
  
  Submitted by:   tijl [1]
  Reported by:    Yuri Karaban <tech@askold.net> [1]
  PR:             154364 [1]
  
  Revision  Changes    Path
  1.479     +1 -1      ports/lang/gcc46/Makefile
  1.345     +10 -10    ports/lang/gcc46/distinfo
  1.112     +4 -4      ports/lang/gcc46/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 dfilter service freebsd_committer freebsd_triage 2011-02-22 18:57:52 UTC
gerald      2011-02-22 18:57:48 UTC

  FreeBSD ports repository

  Added files:
    lang/gcc46/files     patch-default-i486 
  Log:
  Update to the 20110219 snapshot of GCC 4.6.0.
  
  This addresses the pollution of common namespace by
  share/python/aotcompile.py and share/python/classfile.py which are
  now saved in version-specific directories.
  
  By means of an extra patch default code generation on i386 now
  defaults to i486 on FreeBSD 6 and above. [1]
  
  Submitted by:   tijl [1]
  Reported by:    Yuri Karaban <tech@askold.net> [1]
  PR:             154364 [1]
  
  Revision  Changes    Path
  1.1       +25 -0     ports/lang/gcc46/files/patch-default-i486 (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 dfilter service freebsd_committer freebsd_triage 2011-02-22 19:44:43 UTC
gerald      2011-02-22 19:44:39 UTC

  FreeBSD ports repository

  Modified files:
    lang/gcc45           Makefile distinfo 
  Added files:
    lang/gcc45/files     patch-default-i486 
  Log:
  Update to the 20110217 snapshot of GCC 4.5.3.
  
  By means of an extra patch code generation on i386 now defaults to
  i486 on FreeBSD 6 and above. [1]
  
  Submitted by:   tijl [1]
  Reported by:    Yuri Karaban <tech@askold.net> [1]
  PR:             154364 [1]
  
  Revision  Changes    Path
  1.480     +1 -1      ports/lang/gcc45/Makefile
  1.346     +10 -10    ports/lang/gcc45/distinfo
  1.1       +25 -0     ports/lang/gcc45/files/patch-default-i486 (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Gerald Pfeifer freebsd_committer freebsd_triage 2011-02-22 19:45:15 UTC
State Changed
From-To: open->closed

I adjusted lang/gcc45 and lang/gcc46 accordingly and will also push 
this upstream where it's already approved for GCC 4.6 and I am also 
thinking GCC 4.5.