[fpc-devel] Arm Hardfloat

Den Jean Den.Jean at telenet.be
Wed Oct 3 23:39:43 CEST 2012


Hello,

I am trying to compile for hardfloat.

When passing floats as parameters to a C-library function call,
I get incorrect values inside the library.
Both for singles as doubles.

If I write the same call to the c-library in c, 
I get assembler like

call function test_param (int, single, single)

  test_param (i,f1,f2);  

	ldr	r0, [fp, #-8]
	flds	s0, [fp, #-12]
	flds	s1, [fp, #-16]
	bl	test_param

  test_param (142,1.1,2.2);

	mov	r0, #142
	flds	s0, .L3
	flds	s1, .L3+4
	bl	test_param

In pascal I get the following assembler for this call

  test_param(i,f1,f2);

	ldr	r0,.Lj10
	ldr	r2,[r0]
	ldr	r0,.Lj6
	ldr	r1,[r0]
	ldr	r0,.Lj13
	ldr	r0,[r0]
	blx	test_param

  test_param(142,1.1,2.2);

	ldr	r2,.Lj5
	ldr	r1,.Lj8
	mov	r0,#142
	blx	test_param
	blx	FPC_DO_EXIT
	ldmea	r11,{r11,r13,r15}
.Lj5:
	.byte	205,204,12,64
.Lj8:
	.byte	205,204,140,63



Pascal compiler options like
fpc -Aas -O- -CfVFPv3 -Cparmv7 -CaEABI  pmain.pp
or
fpc -Aas -dFPC_ARMEL -O- -dFPC_ABI_EABI -CfVFPv3 -Cparmv7  -CaEABI pmain 

using fpc svn fixes_2_6 Revision: 22520

G++ calls as with -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -meabi=5
and is configured with 
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/4.7.1/lto-
wrapper
Target: armv7l-unknown-linux-gnueabihf
Configured with: /build/src/gcc-4.7-20120721/configure --prefix=/usr --
libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --
infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-
languages=c,c++,fortran,lto,objc,obj-c++ --enable-shared --enable-
threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-
exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-
time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-
cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --
enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-
ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --
disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-
checking=release --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-
linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
Thread model: posix
gcc version 4.7.1 20120721 (prerelease) (GCC)

$ fpc -i
Free Pascal Compiler version 2.6.1

Compiler Date      : 2012/10/03
Compiler CPU Target: arm
<snip>
Supported CPU instruction sets:
  ARMV3
  ARMV4
  ARMV5
  ARMV6
  ARMV7
  ARMV7M
  CORTEXM3

Supported FPU instruction sets:
  SOFT
  LIBGCC
  FPA
  FPA10
  FPA11
  VFPV2
  VFPV3

Supported ABI targets:
  DEFAULT
  SYSV
  AIX
  EABI
  ARMEB
<snip>

Platform: Beaglebone
$ cat /proc/cpuinfo 
Processor       : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 498.89
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc08
CPU revision    : 2

Hardware        : am335xevm
Revision        : 0000
Serial          : 0000000000000000

Kind regards,

Den Jean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20121003/58927b64/attachment.html>


More information about the fpc-devel mailing list