summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-08-02 15:57:32 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-08-02 18:21:30 +0200
commitd5a100f59467d94945656b54563e5ecdde2ca724 (patch)
tree7a03d28653789b8cd00592ec97633ee9798c81c1 /bridges
parenta6555eb809e2580562cd431085e35a23b7d47f9a (diff)
tdf#143450: Special integre+fp struct return case needs a fix too, of course
...similar to ca344be7aabf88dddde38841e6af6292ece6829b "tdf#143450: Fix special fp+integer struct return case for gcc_*_x86-64" Change-Id: Ia8110d632a1c5f328822c434efc5b09bd53ec9e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119883 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx7
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx3
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/call.s11
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx18
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx7
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.hxx3
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/call.cxx12
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx18
8 files changed, 59 insertions, 20 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
index f36678ed3695..243e42d057e8 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
@@ -269,7 +269,12 @@ x86_64::ReturnKind x86_64::getReturnKind(typelib_TypeDescriptionReference * type
if (n == 2 && (classes[0] == X86_64_SSE_CLASS || classes[0] == X86_64_SSESF_CLASS)
&& (classes[1] == X86_64_INTEGER_CLASS || classes[1] == X86_64_INTEGERSI_CLASS))
{
- return ReturnKind::RegistersSpecial;
+ return ReturnKind::RegistersFpInt;
+ }
+ if (n == 2 && (classes[0] == X86_64_INTEGER_CLASS || classes[0] == X86_64_INTEGERSI_CLASS)
+ && (classes[1] == X86_64_SSE_CLASS || classes[1] == X86_64_SSESF_CLASS))
+ {
+ return ReturnKind::RegistersIntFp;
}
return ReturnKind::RegistersGeneral;
}
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
index db1ed75aa243..3ef80543ac76 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
@@ -54,7 +54,8 @@ bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) noexce
enum class ReturnKind {
Memory,
RegistersGeneral,
- RegistersSpecial
+ RegistersFpInt,
+ RegistersIntFp
};
ReturnKind getReturnKind(typelib_TypeDescriptionReference * type) noexcept;
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s b/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s
index ee8403ab7180..53bfea8b254f 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s
@@ -55,17 +55,22 @@ privateSnippetExecutor:
call cpp_vtable_call
- cmp $1, %rax
- je .Lspecial
+ testl %eax, %eax
+ je .Lfpint
+ jg .Lintfp
movq -144(%rbp), %rax # Potential return value (general case)
movq -136(%rbp), %rdx # Potential return value (general case)
movq -144(%rbp), %xmm0 # Potential return value (general case)
movq -136(%rbp), %xmm1 # Potential return value (general case)
jmp .Lfinish
-.Lspecial:
+.Lfpint:
movq -144(%rbp), %xmm0 # Return value (special fp and integer case)
movq -136(%rbp), %rax # Return value (special fp and integer case)
+ jmp .Lfinish
+.Lintfp:
+ movq -144(%rbp), %rax # Return value (special integer and fp case)
+ movq -136(%rbp), %xmm0 # Return value (special integer and fp case)
.Lfinish:
leave
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
index 4bf5061a472f..de393582f99a 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -246,16 +246,24 @@ static int cpp2uno_call(
{
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
}
- return returnKind == x86_64::ReturnKind::RegistersSpecial ? 1 : 0;
+ switch (returnKind) {
+ case x86_64::ReturnKind::RegistersFpInt:
+ return 0;
+ case x86_64::ReturnKind::RegistersIntFp:
+ return 1;
+ default:
+ return -1;
+ }
}
}
-// Returns 0 for the general case where potential return values from privateSnippetExecutor can be
+// Returns -1 for the general case where potential return values from privateSnippetExecutor can be
// copied from pRegisterReturn to both %rax and %rdx (in that order) and to %xmm0 and %xmm1 (in that
// order)---each specific return type will only require a subset of that copy operations, but the
-// other copies to those non--callee-saved registers will be redundant and harmless. And returns 1
-// for the special case where return values from privateSnippetExecutor must be copied from
-// pRegisterReturn to %xmm0 and %rax (in that order).
+// other copies to those non--callee-saved registers will be redundant and harmless. Returns 0 for
+// the special case where return values from privateSnippetExecutor must be copied from
+// pRegisterReturn to %xmm0 and %rax (in that order). Returns 1 for the special case where return
+// privateSnippetExecutor must be copied from pRegisterReturn to %rax and %xmm0 (in that order).
int cpp_vtable_call(
sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
void ** gpreg, void ** fpreg, void ** ovrflw,
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx
index 355a0a7500d7..8f6ca30957ed 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx
@@ -268,7 +268,12 @@ x86_64::ReturnKind x86_64::getReturnKind(typelib_TypeDescriptionReference * type
if (n == 2 && (classes[0] == X86_64_SSE_CLASS || classes[0] == X86_64_SSESF_CLASS)
&& (classes[1] == X86_64_INTEGER_CLASS || classes[1] == X86_64_INTEGERSI_CLASS))
{
- return ReturnKind::RegistersSpecial;
+ return ReturnKind::RegistersFpInt;
+ }
+ if (n == 2 && (classes[0] == X86_64_INTEGER_CLASS || classes[0] == X86_64_INTEGERSI_CLASS)
+ && (classes[1] == X86_64_SSE_CLASS || classes[1] == X86_64_SSESF_CLASS))
+ {
+ return ReturnKind::RegistersIntFp;
}
return ReturnKind::RegistersGeneral;
}
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.hxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.hxx
index db1ed75aa243..3ef80543ac76 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.hxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.hxx
@@ -54,7 +54,8 @@ bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) noexce
enum class ReturnKind {
Memory,
RegistersGeneral,
- RegistersSpecial
+ RegistersFpInt,
+ RegistersIntFp
};
ReturnKind getReturnKind(typelib_TypeDescriptionReference * type) noexcept;
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.cxx
index a0654104012d..2c7332a16a2b 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/call.cxx
@@ -55,8 +55,9 @@ void privateSnippetExecutor()
" call _cpp_vtable_call\n"
- " cmp $1, %rax\n"
- " je .Lspecial\n"
+ " testl %eax, %eax\n"
+ " je .Lfpint\n"
+ " jg .Lintfp\n"
" movq -144(%rbp), %rax # Potential return value (general case)\n"
" movq -136(%rbp), %rdx # Potential return value (general case)\n"
@@ -64,9 +65,14 @@ void privateSnippetExecutor()
" movq -136(%rbp), %xmm1 # Potential return value (general case)\n"
" jmp .Lfinish\n"
- ".Lspecial:\n"
+ ".Lfpint:\n"
" movq -144(%rbp), %xmm0 # Return value (special fp and integer case)\n"
" movq -136(%rbp), %rax # Return value (special fp and integer case)\n"
+ " jmp .Lfinish\n"
+
+ ".Lintfp:\n"
+ " movq -144(%rbp), %rax # Return value (special integer and fp case)\n"
+ " movq -136(%rbp), %xmm0 # Return value (special integer and fp case)\n"
".Lfinish:\n"
" addq $160, %rsp\n"
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
index 4a150ef81a9a..efdf211d8a6e 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
@@ -248,16 +248,24 @@ static int cpp2uno_call(
{
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
}
- return returnKind == x86_64::ReturnKind::RegistersSpecial ? 1 : 0;
+ switch (returnKind) {
+ case x86_64::ReturnKind::RegistersFpInt:
+ return 0;
+ case x86_64::ReturnKind::RegistersIntFp:
+ return 1;
+ default:
+ return -1;
+ }
}
}
-// Returns 0 for the general case where potential return values from privateSnippetExecutor can be
+// Returns -1 for the general case where potential return values from privateSnippetExecutor can be
// copied from pRegisterReturn to both %rax and %rdx (in that order) and to %xmm0 and %xmm1 (in that
// order)---each specific return type will only require a subset of that copy operations, but the
-// other copies to those non--callee-saved registers will be redundant and harmless. And returns 1
-// for the special case where return values from privateSnippetExecutor must be copied from
-// pRegisterReturn to %xmm0 and %rax (in that order).
+// other copies to those non--callee-saved registers will be redundant and harmless. Returns 0 for
+// the special case where return values from privateSnippetExecutor must be copied from
+// pRegisterReturn to %xmm0 and %rax (in that order). Returns 1 for the special case where return
+// privateSnippetExecutor must be copied from pRegisterReturn to %rax and %xmm0 (in that order).
int cpp_vtable_call(
sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
void ** gpreg, void ** fpreg, void ** ovrflw,