Pedro Alves wrote:
Pedro Alves wrote:The float ABI is something that has been on my todo list,like confirming the alignments, packing, endianess, calling conventions related to floats/doubles. I would really like to find some authorative (MSDN/Microsoft) information about this.Well, talking is cheap... Just got home, and tested this on mingw32ce: #include <stdio.h> int main(int argc, char** argv) { printf (#%d, %f, %d\n", 1, (double)3.4f, 3); return 0; } With : ´-mfloat-abi=soft -mfpu=fpa´ (bigendian doubles) '-mfloat-abi=hard' (bigendian doubles) The result is: 1, 2.000000, 3 but, with: '-mfpu=vfp' (little endian doubles) I get a good result. Pretty much ignore what I said about WinCE's float abi being bigendian.The doubles must be stored as little endian. That will teach me to test before asserting things :)Our default of -mfloat-abi=soft -mfpu-vfp does exactly that.(actually, '-msoft-float -mfpu-vfp', but '-msoft-float' == '-mfloat-abi=soft')So to generate vfp instructions, you can use: '-mfloat-abi=softfp -mfpu-vfp' There you go Andy, we are WinCE 6 ready :) I don't know if changing to softfp breaks anything... I'll do a local change, and test this (going to take a while). I'll post here my findings. Meanwhile, if someone finds more informationregarding *WinCE's* float ABI, please send it over. I would really appreciate it.
Here are my findings: Really nothing new, but just confirmations on my previous post.It looks like WinCE always wants doubles in natural order, meaning little endian on most (all?) devices.
gcc, when passed -mfpu=fpa, always makes doubles big endian aligned, because that's that fpa co-processors want. That means it is not possible, without hacking gcc, to use fpa compiled code interfacing with system libs expecting doubles with natural alignment. I don't thing this really matters now that fpa is deprecated, and being fased out.
To build for soft floats, LE, pass '-mfloat-abi=soft -mfpu=vfp'. soft abi never emits coprocessor insns, so the vfp fpu selection
is only there to ensure the endianess.This is the default setting for our toolchains. Mainline gcc appears to be broken here, as it defaults to fpa, BE.
That will be corrected when our patches are sent upstream.To build for vfp, LE, pass '-mfloat-abi=softfp -mfpu=vfp' to gcc. The soft floats ABI will still be respected, that is, gcc will pass floats/doubles in integers, but will do any arithmetic with real vfp insns.
Cirrus Maverick floating point co-processor based code emitted from gcc should work ok too,
as it is always little endian, but I don't have a device to test that.Attached is a tar.gz with some tests I made. Inside you will find source code for two programs. One that does some calcs and then calls coredll's printf, and another that just calls printf with a double, to test the endian mode. I then build those programs with a bunch float abis/fpu permutations, and tested on my device. There is a results.txt file where I registered the findings.
Cheers, Pedro Alves
fpu_tests.tar.gz
Description: application/gzip
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel