tdf#143450: Fix special fp+integer struct return case for gcc_*_x86-64

For one, the loop in x86_64::fill_struct was backwards.

And for another, privateSnippedExecutor does not need special handling of FLOAT
and DOUBLE return values (they can simply be moved to %xmm0, as covered by the
general case), but rather for those small structs where floating-point member(s)
in a first eightbyte (targeting %xmm0) are followed by integer member(s) in a
second eightbyte (targeting %rax).  Extended testtools to cover two such cases.

Change-Id: I8e775a1d1ce2312610f265bcc8e40b09bdac56df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119576
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2021-07-28 13:08:07 +02:00
parent f7709a6594
commit ca344be7aa
15 changed files with 156 additions and 52 deletions
@@ -41,6 +41,8 @@ import test.testtools.bridgetest.BigStruct;
import test.testtools.bridgetest.TwoFloats;
import test.testtools.bridgetest.FourFloats;
import test.testtools.bridgetest.MixedFloatAndInteger;
import test.testtools.bridgetest.DoubleHyper;
import test.testtools.bridgetest.FloatFloatLongByte;
import test.testtools.bridgetest.ThreeByteStruct;
import test.testtools.bridgetest.XBridgeTest;
import test.testtools.bridgetest.XBridgeTest2;
@@ -504,6 +506,16 @@ public class TestComponent {
return i_Struct;
}
public DoubleHyper echoDoubleHyper(DoubleHyper s) throws com.sun.star.uno.RuntimeException {
return s;
}
public FloatFloatLongByte echoFloatFloatLongByte(FloatFloatLongByte s)
throws com.sun.star.uno.RuntimeException
{
return s;
}
public ThreeByteStruct echoThreeByteStruct( ThreeByteStruct i_Struct) throws com.sun.star.uno.RuntimeException {
return i_Struct;
}
@@ -484,6 +484,20 @@ static bool performTest(
MixedFloatAndInteger aOut = xLBT->echoMixedFloatAndInteger(aIn);
bRet = check( memcmp(&aIn, &aOut, sizeof(MixedFloatAndInteger)) == 0, "mixed float and integer struct test" ) && bRet;
}
{
DoubleHyper in(10.0, 11);
DoubleHyper out = xLBT->echoDoubleHyper(in);
bRet &= check(out.a == in.a, "double and hyper struct test: double")
&& check(out.b == in.b, "double and hyper struct test: hyper");
}
{
FloatFloatLongByte in(20.0f, 21.0f, 22, '3');
FloatFloatLongByte out = xLBT->echoFloatFloatLongByte(in);
bRet &= check(out.a == in.a, "double and hyper struct test: first float")
&& check(out.b == in.b, "double and hyper struct test: second float")
&& check(out.c == in.c, "double and hyper struct test: long")
&& check(out.d == in.d, "double and hyper struct test: byte");
}
{
ThreeByteStruct aIn(9, 10, 11);
ThreeByteStruct aOut = xLBT->echoThreeByteStruct(aIn);
@@ -259,6 +259,10 @@ public class BridgeTestObject : WeakBase, XRecursiveCall, XBridgeTest2
return arg;
}
public DoubleHyper echoDoubleHyper(Mix s) { return s; }
public FloatFloatLongByte echoFloatFloatLongByte(Mix s) { return s; }
public ThreeByteStruct echoThreeByteStruct(/*[in]*/ThreeByteStruct arg)
{
return arg;
+4
View File
@@ -245,6 +245,10 @@ public:
{ return rStruct; }
virtual MixedFloatAndInteger SAL_CALL echoMixedFloatAndInteger(const MixedFloatAndInteger& rStruct) override
{ return rStruct; }
virtual DoubleHyper SAL_CALL echoDoubleHyper(DoubleHyper const & s) override { return s; }
virtual FloatFloatLongByte SAL_CALL echoFloatFloatLongByte(FloatFloatLongByte const & s)
override
{ return s; }
virtual ThreeByteStruct SAL_CALL echoThreeByteStruct(const ThreeByteStruct& rStruct) override
{ return rStruct; }
virtual sal_Int32 SAL_CALL testPPCAlignment( sal_Int64, sal_Int64, sal_Int32, sal_Int64, sal_Int32 i2 ) override
@@ -122,6 +122,16 @@ struct MixedFloatAndInteger
float a;
long b;
};
struct DoubleHyper {
double a;
hyper b;
};
struct FloatFloatLongByte {
float a;
float b;
long c;
byte d;
};
/**
* Small struct with three bytes. Should *not* return in registers on
* BSDs/MACOSx
@@ -328,6 +338,10 @@ interface XBridgeTestBase : com::sun::star::uno::XInterface
*/
MixedFloatAndInteger echoMixedFloatAndInteger( [in] MixedFloatAndInteger aStruct );
DoubleHyper echoDoubleHyper([in] DoubleHyper s);
FloatFloatLongByte echoFloatFloatLongByte([in] FloatFloatLongByte s);
/**
* register return test 7
*/