aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-10-17 19:39:58 +0200
committerTristan Gingold <tgingold@free.fr>2022-10-17 19:40:01 +0200
commit53b68892a6786c2cb4de512a9d2e6a0a0f7e26fb (patch)
treed3c1be4679d16b8f7164a0fbaec446b0ad895ecf /src/ortho
parent8259ae6a5f27ae773c44a4783c4c6d9b2ac8f252 (diff)
downloadghdl-53b68892a6786c2cb4de512a9d2e6a0a0f7e26fb.tar.gz
ghdl-53b68892a6786c2cb4de512a9d2e6a0a0f7e26fb.tar.bz2
ghdl-53b68892a6786c2cb4de512a9d2e6a0a0f7e26fb.zip
win64: fix FP argument passing
Diffstat (limited to 'src/ortho')
-rw-r--r--src/ortho/mcode/ortho_code-x86-abi.adb10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ortho/mcode/ortho_code-x86-abi.adb b/src/ortho/mcode/ortho_code-x86-abi.adb
index 2b0d778fa..981736dd9 100644
--- a/src/ortho/mcode/ortho_code-x86-abi.adb
+++ b/src/ortho/mcode/ortho_code-x86-abi.adb
@@ -74,8 +74,14 @@ package body Ortho_Code.X86.Abi is
Abi.Inum := Abi.Inum + 1;
end if;
when Mode_Fp =>
- if Abi.Fnum <= Sse_Regs'Last (2) then
- Reg := Sse_Regs (Flags.Win64, Abi.Fnum);
+ if Flags.Win64 then
+ -- On Win64, only the first 4 arguments are passed in regs.
+ if Abi.Inum < 4 then
+ Reg := Sse_Regs (True, Abi.Inum);
+ Abi.Inum := Abi.Inum + 1;
+ end if;
+ elsif Abi.Fnum <= Sse_Regs'Last (2) then
+ Reg := Sse_Regs (False, Abi.Fnum);
Abi.Fnum := Abi.Fnum + 1;
end if;
when others =>