Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 75585 - ARM gcc's soft-float softvfp patch
Summary: ARM gcc's soft-float softvfp patch
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: ARM Linux
: High enhancement (vote)
Assignee: Gentoo ARM Porters
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-24 15:44 UTC by Yuri Vasilevski (RETIRED)
Modified: 2005-08-20 09:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
gcc-3.3.4-3.3.5-softvfp.patch (gcc-3.3.4-3.3.5-softvfp.patch,71.85 KB, patch)
2004-12-24 15:45 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
uclibc-softvfp-gentoo.patch (uclibc-softvfp-gentoo.patch,387 bytes, patch)
2004-12-24 15:45 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
uclibc-0.9.26-r7.ebuild.patch (uclibc-0.9.26-r7.ebuild.patch,956 bytes, patch)
2004-12-24 15:47 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
gcc-3.3.4-r1.ebuild.patch (gcc-3.3.4-r1.ebuild.patch,794 bytes, patch)
2004-12-24 15:48 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
gcc-3.3.5-r1.ebuild.patch (gcc-3.3.5-r1.ebuild.patch,773 bytes, patch)
2004-12-24 15:48 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
nbench.nwfpemu.Os.out (nbench.nwfpemu.Os.out,1.62 KB, text/plain)
2004-12-24 15:51 UTC, Yuri Vasilevski (RETIRED)
Details
nbench.nwfpemu.O3.out (nbench.nwfpemu.O3.out,1.62 KB, text/plain)
2004-12-24 15:51 UTC, Yuri Vasilevski (RETIRED)
Details
nbench.softvfp.Os.out (nbench.softvfp.Os.out,1.62 KB, text/plain)
2004-12-24 15:52 UTC, Yuri Vasilevski (RETIRED)
Details
nbench.softvfp.O3.out (nbench.softvfp.O3.out,1.62 KB, text/plain)
2004-12-24 15:53 UTC, Yuri Vasilevski (RETIRED)
Details
nbench.libfloat.Os.out (nbench.libfloat.Os.out,1.62 KB, text/plain)
2004-12-24 15:54 UTC, Yuri Vasilevski (RETIRED)
Details
nbench.libfloat.O3.out (nbench.libfloat.O3.out,1.62 KB, text/plain)
2004-12-24 15:54 UTC, Yuri Vasilevski (RETIRED)
Details
gcc-3.4.4.ebuild.patch (gcc-3.4.4.ebuild.patch,755 bytes, patch)
2005-06-30 15:38 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
gcc-3.4.4-softvfp.patch (gcc-3.4.4-softvfp.patch,5.65 KB, patch)
2005-06-30 15:38 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
softvfp-profile.patch (softvfp-profile.patch,1.14 KB, patch)
2005-07-05 09:15 UTC, Yuri Vasilevski (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:44:49 UTC
ARM gcc's soft-float softvfp patch

I modified N. Pitre's soft-float gcc patch to work more like the official gcc in a sense of what processors' the code will be generated, but it still defaults to softvfp soft-float.

This gives a 10x speedup in floating point code and 1.2x speedup in integer code (by default gcc "uses" non existent coprocessor's registers).

I propose the use of nofpu USE flag (like mmx/sse/.. on x86) for gcc and uclibc to be added, and in case they are set, the patches to be applied.

Also, it is worth noting that code generated with this soft-float patch runs very well on softgun (an ARM emulator), which may be very useful for Gentoo/ARM development.

And all the attached benchmarks were made on a Sharp Zaurus SL-5500, form a fresh boot to openzaurus 3.3.5 with a 64-0 kernel.

Yuri.

Reproducible: Always
Steps to Reproduce:
Comment 1 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:45:34 UTC
Created attachment 46814 [details, diff]
gcc-3.3.4-3.3.5-softvfp.patch
Comment 2 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:45:57 UTC
Created attachment 46815 [details, diff]
uclibc-softvfp-gentoo.patch
Comment 3 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:47:40 UTC
Created attachment 46816 [details, diff]
uclibc-0.9.26-r7.ebuild.patch

Patch for latest arm and ~arm ebuild.
Comment 4 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:48:19 UTC
Created attachment 46817 [details, diff]
gcc-3.3.4-r1.ebuild.patch

Patch for latest arm ebuild.
Comment 5 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:48:58 UTC
Created attachment 46818 [details, diff]
gcc-3.3.5-r1.ebuild.patch

Patch for latest ~arm ebuild.
Comment 6 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:51:18 UTC
Created attachment 46820 [details]
nbench.nwfpemu.Os.out

Kernel's floating point emulation
CFLAGS="-Os -pipe -static"
Comment 7 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:51:55 UTC
Created attachment 46821 [details]
nbench.nwfpemu.O3.out

Kernel's floating point emulation
CFLAGS="-O3 -pipe -static"
Comment 8 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:52:47 UTC
Created attachment 46822 [details]
nbench.softvfp.Os.out

softvfp floating point emulation
CFLAGS="-Os -pipe -static"
Comment 9 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:53:13 UTC
Created attachment 46823 [details]
nbench.softvfp.O3.out

softvfp floating point emulation
CFLAGS="-O3 -pipe -static"
Comment 10 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:54:05 UTC
Created attachment 46824 [details]
nbench.libfloat.Os.out

uClibc libfloat's floating point emulation
CFLAGS="-Os -pipe -static"
Comment 11 Yuri Vasilevski (RETIRED) gentoo-dev 2004-12-24 15:54:41 UTC
Created attachment 46825 [details]
nbench.libfloat.O3.out

uClibc libfloat's floating point emulation
CFLAGS="-O3 -pipe -static"
Comment 12 Yuri Vasilevski (RETIRED) gentoo-dev 2005-06-30 15:38:14 UTC
Created attachment 62359 [details, diff]
gcc-3.4.4.ebuild.patch
Comment 13 Yuri Vasilevski (RETIRED) gentoo-dev 2005-06-30 15:38:43 UTC
Created attachment 62360 [details, diff]
gcc-3.4.4-softvfp.patch
Comment 14 Yuri Vasilevski (RETIRED) gentoo-dev 2005-07-05 09:15:03 UTC
Created attachment 62680 [details, diff]
softvfp-profile.patch

Portage profile for softvfp arm systems.
Comment 15 Yuri Vasilevski (RETIRED) gentoo-dev 2005-07-12 18:34:14 UTC
stages can be found at: http://yvasilev.main.hsphere.com/zentoo/stages/

Yuri.
Comment 16 Phattanon Duangdara 2005-08-03 10:56:36 UTC
After modified some lines, Patch seems to work well. But gcc stage2 (of
crossdev) compile failes if have cxx support.

Are there any patches for compile cxx support on toolchains ?
Comment 17 Phattanon Duangdara 2005-08-04 02:07:55 UTC
I have found that this patches need 

EXTRA_ECONF="--with-float=soft"

when use crossdev stage 1 (and others) that build gcc

from 

http://www.mail-archive.com/gentoo-embedded@lists.gentoo.org/msg00048.html
Comment 18 SpanKY gentoo-dev 2005-08-04 17:06:10 UTC
Comment on attachment 46815 [details, diff]
uclibc-softvfp-gentoo.patch

merged upstream uClibc svn and in portage
Comment 19 SpanKY gentoo-dev 2005-08-04 17:06:33 UTC
Comment on attachment 62680 [details, diff]
softvfp-profile.patch

no need for this if we're going to use CHOST encoding ...
Comment 20 SpanKY gentoo-dev 2005-08-04 19:16:37 UTC
ive committed the softfloat configure check to toolchain.eclass ... only thing
left is the softvfp patch ...

the only problem is the hunk against gcc/config/arm/t-linux ... is that needed ?
 reviewing the gcc mailing lists, that hunk seems like a bad idea ...
Comment 21 Phattanon Duangdara 2005-08-05 08:01:08 UTC
This my modified by hand

I think it needed to prevents linking with libfloat.


diff -Naur gcc-3.4.4-orig/gcc/config/arm/t-linux gcc-3.4.4/gcc/config/arm/t-linux
--- gcc-3.4.4-orig/gcc/config/arm/t-linux       2003-09-20 15:09:07 -0600
+++ gcc-3.4.4/gcc/config/arm/t-linux    2005-06-28 13:09:46 -0600
@@ -4,7 +4,10 @@
 LIBGCC2_DEBUG_CFLAGS = -g0

 LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
+       _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
+       _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
+       _fixsfsi _fixunssfsi

 # MULTILIB_OPTIONS = mhard-float/msoft-float
 # MULTILIB_DIRNAMES = hard-float soft-float
diff -Naur gcc-3.4.4-orig/gcc/config/arm/unknown-elf.h
gcc-3.4.4/gcc/config/arm/unknown-elf.h
--- gcc-3.4.4-orig/gcc/config/arm/unknown-elf.h 2004-02-24 07:25:22 -0700
+++ gcc-3.4.4/gcc/config/arm/unknown-elf.h      2005-06-28 13:13:09 -0600
@@ -30,7 +30,12 @@

 /* Default to using APCS-32 and software floating point.  */
 #ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 |
ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
+#define TARGET_DEFAULT         \
+       ( ARM_FLAG_SOFT_FLOAT   \
+       | ARM_FLAG_VFP          \
+       | ARM_FLAG_APCS_32      \
+       | ARM_FLAG_APCS_FRAME   \
+       | ARM_FLAG_MMU_TRAPS )
 #endif
Comment 22 Yuri Vasilevski (RETIRED) gentoo-dev 2005-08-05 10:17:30 UTC
(In reply to comment #20)
> the only problem is the hunk against gcc/config/arm/t-linux ... is that needed ?
>  reviewing the gcc mailing lists, that hunk seems like a bad idea ...

As far as I understand this, the patch to t-linux is harmful in case we are
doing a mix of hard and soft float (use soft-float routines only to complete the
functionality of an incomplete floating point coprocessor). As in this case
softvfp may not be compatible with the hard fp coprocessor that will do some fp
operations.

But in this case as we are doing a softfloat system, t-linux needs to (Comment
#21) and it is safe to be patched. As the hard-float and ``mix
Comment 23 Yuri Vasilevski (RETIRED) gentoo-dev 2005-08-05 10:17:30 UTC
(In reply to comment #20)
> the only problem is the hunk against gcc/config/arm/t-linux ... is that needed ?
>  reviewing the gcc mailing lists, that hunk seems like a bad idea ...

As far as I understand this, the patch to t-linux is harmful in case we are
doing a mix of hard and soft float (use soft-float routines only to complete the
functionality of an incomplete floating point coprocessor). As in this case
softvfp may not be compatible with the hard fp coprocessor that will do some fp
operations.

But in this case as we are doing a softfloat system, t-linux needs to (Comment
#21) and it is safe to be patched. As the hard-float and ``mix´´-float cases are
covered by the default toolchain.
Comment 24 SpanKY gentoo-dev 2005-08-05 15:11:44 UTC
ok, everything is merged now in portage

if you could rebuild the arm softfloat stages with
CHOST=arm-softfloat-linux-uclibc we can probably move on to the next stage of
getting them onto our mirrors for wider testing :)

i'll try to get armeb-softfloat-linux-uclibc going on my slug ...
Comment 25 Yuri Vasilevski (RETIRED) gentoo-dev 2005-08-20 09:09:40 UTC
CHOST=arm-softfloat-linux-uclibc stages are available at
http://yvasilev.main.hsphere.com/zentoo/stages/