summaryrefslogtreecommitdiff
path: root/packages/rtl-objpas
diff options
context:
space:
mode:
authorsvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-12-26 22:59:30 +0000
committersvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-12-26 22:59:30 +0000
commitde7d126290b1d59acb6da7b6dfa45456f4f3f5b7 (patch)
treec706592964b851c6816ea5d9cc9b4a5ef5f9247b /packages/rtl-objpas
parentd61501f63ac3ae9a74126153ff5ec26ed978a9cb (diff)
downloadfpc-de7d126290b1d59acb6da7b6dfa45456f4f3f5b7.tar.gz
* correctly handle a floating point result
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40664 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/rtl-objpas')
-rw-r--r--packages/rtl-objpas/src/x86_64/invoke.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/rtl-objpas/src/x86_64/invoke.inc b/packages/rtl-objpas/src/x86_64/invoke.inc
index c0bf62ed82..ba6516d168 100644
--- a/packages/rtl-objpas/src/x86_64/invoke.inc
+++ b/packages/rtl-objpas/src/x86_64/invoke.inc
@@ -28,6 +28,8 @@ asm
.seh_savereg %rsi, 16
movq %rdi, 24(%rsp)
.seh_savereg %rdi, 24
+ movq %r8, 32(%rsp)
+.seh_savereg %r8, 32
movq %rsp, %rbp
.seh_setframe %rbp, 0
@@ -71,6 +73,10 @@ asm
{ restore non-volatile registers }
movq %rbp, %rsp
+ { we abuse the register area pointer for an eventual SSE2 result }
+ movq 32(%rsp), %rdi
+ movq %xmm0, (%rdi)
+
movq 24(%rsp), %rdi
movq 16(%rsp), %rsi
movq 8(%rsp), %rbp
@@ -249,6 +255,11 @@ begin
if Assigned(aResultType) and not retinparam then begin
PPtrUInt(aResultValue)^ := val;
+ if aResultType^.Kind = tkFloat then begin
+ td := GetTypeData(aResultType);
+ if td^.FloatType in [ftSingle, ftDouble] then
+ PPtrUInt(aResultValue)^ := regs[0];
+ end;
end;
{$else}
raise EInvocationError.Create(SErrPlatformNotSupported);