diff options
author | Peter Trommler <ptrommler@acm.org> | 2016-06-18 12:28:41 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-06-19 00:27:06 +0200 |
commit | 2897be77123bf31cad1c60dd5560eba7f2f021ce (patch) | |
tree | 9c7e023e6f1995bd0bc1662b896ccb66384b2d23 /testsuite/tests/ffi | |
parent | f12fb8ab5d5ad7a26c84f98e446bc70064dcdcec (diff) | |
download | haskell-2897be77123bf31cad1c60dd5560eba7f2f021ce.tar.gz |
PPC NCG: Fix float parameter passing on 64-bit.
On Linux 64-bit PowerPC the first 13 floating point parameters are
passed in registers. We only passed the first 8 floating point params.
The alignment of a floating point single precision value in ELF v1.9 is
the second word of a doubleword. For ELF v2 we support only little
endian and the least significant word of a doubleword is the first word,
so no special handling is required.
Add a regression test.
Test Plan: validate on powerpc Linux and AIX
Reviewers: erikd, hvr, austin, simonmar, bgamari
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2327
GHC Trac Issues: #12134
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r-- | testsuite/tests/ffi/should_run/T12134.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/T12134.stdout | 15 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/T12134_c.c | 8 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/all.T | 6 |
4 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_run/T12134.hs b/testsuite/tests/ffi/should_run/T12134.hs new file mode 100644 index 0000000000..f07d892b19 --- /dev/null +++ b/testsuite/tests/ffi/should_run/T12134.hs @@ -0,0 +1,8 @@ +import Foreign.C.Types + +foreign import ccall "many_floats" many :: CFloat -> CFloat -> + CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> + CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> + CDouble -> IO () + +main = many 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 diff --git a/testsuite/tests/ffi/should_run/T12134.stdout b/testsuite/tests/ffi/should_run/T12134.stdout new file mode 100644 index 0000000000..798f1a2e38 --- /dev/null +++ b/testsuite/tests/ffi/should_run/T12134.stdout @@ -0,0 +1,15 @@ +1.500000 +2.500000 +3.500000 +4.500000 +5.500000 +6.500000 +7.500000 +8.500000 +9.500000 +10.500000 +11.500000 +12.500000 +13.500000 +14.500000 +15.500000 diff --git a/testsuite/tests/ffi/should_run/T12134_c.c b/testsuite/tests/ffi/should_run/T12134_c.c new file mode 100644 index 0000000000..0e616707eb --- /dev/null +++ b/testsuite/tests/ffi/should_run/T12134_c.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +void many_floats(float f1, float f2, float f3, float f4, float f5, + float f6, float f7, float f8, float f9, float f10, + float f11, float f12, float f13, float f14, double f15) { + printf("%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n", + f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15); +} diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T index eb2c15279f..efb696906e 100644 --- a/testsuite/tests/ffi/should_run/all.T +++ b/testsuite/tests/ffi/should_run/all.T @@ -217,3 +217,9 @@ test('ffi023', [ omit_ways(['ghci']), # ffi023_stub.h before compiling ffi023_c.c, which # needs it. compile_and_run, ['ffi023_c.c']) + +test('T12134', + [omit_ways(['ghci']), extra_clean(['T12134_c.o'])], + compile_and_run, + ['T12134_c.c']) + |