| // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| // |
| // This file has been automatically generated. Please do not edit it manually. |
| // Generated by tests/ffi/generator/structs_by_value_tests_generator.dart. |
| |
| #include <stdarg.h> |
| #include <stddef.h> |
| #include <stdint.h> |
| #include <stdlib.h> |
| #include <sys/types.h> |
| |
| #include <cmath> |
| #include <iostream> |
| #include <limits> |
| |
| #if defined(_WIN32) |
| #define DART_EXPORT extern "C" __declspec(dllexport) |
| #else |
| #define DART_EXPORT \ |
| extern "C" __attribute__((visibility("default"))) __attribute((used)) |
| #endif |
| |
| namespace dart { |
| |
| #define CHECK(X) \ |
| if (!(X)) { \ |
| fprintf(stderr, "%s\n", "Check failed: " #X); \ |
| return 1; \ |
| } |
| |
| #define CHECK_EQ(X, Y) CHECK((X) == (Y)) |
| |
| // Works for positive, negative and zero. |
| #define CHECK_APPROX(EXPECTED, ACTUAL) \ |
| CHECK(((EXPECTED * 0.99) <= (ACTUAL) && (EXPECTED * 1.01) >= (ACTUAL)) || \ |
| ((EXPECTED * 0.99) >= (ACTUAL) && (EXPECTED * 1.01) <= (ACTUAL))) |
| |
| struct Struct1ByteBool { |
| bool a0; |
| }; |
| |
| struct Struct1ByteInt { |
| int8_t a0; |
| }; |
| |
| struct Struct3BytesHomogeneousUint8 { |
| uint8_t a0; |
| uint8_t a1; |
| uint8_t a2; |
| }; |
| |
| struct Struct3BytesInt2ByteAligned { |
| int16_t a0; |
| int8_t a1; |
| }; |
| |
| struct Struct4BytesHomogeneousInt16 { |
| int16_t a0; |
| int16_t a1; |
| }; |
| |
| struct Struct4BytesFloat { |
| float a0; |
| }; |
| |
| struct Struct7BytesHomogeneousUint8 { |
| uint8_t a0; |
| uint8_t a1; |
| uint8_t a2; |
| uint8_t a3; |
| uint8_t a4; |
| uint8_t a5; |
| uint8_t a6; |
| }; |
| |
| struct Struct7BytesInt4ByteAligned { |
| int32_t a0; |
| int16_t a1; |
| int8_t a2; |
| }; |
| |
| struct Struct8BytesInt { |
| int16_t a0; |
| int16_t a1; |
| int32_t a2; |
| }; |
| |
| struct Struct8BytesHomogeneousFloat { |
| float a0; |
| float a1; |
| }; |
| |
| struct Struct8BytesFloat { |
| double a0; |
| }; |
| |
| struct Struct8BytesMixed { |
| float a0; |
| int16_t a1; |
| int16_t a2; |
| }; |
| |
| struct Struct9BytesHomogeneousUint8 { |
| uint8_t a0; |
| uint8_t a1; |
| uint8_t a2; |
| uint8_t a3; |
| uint8_t a4; |
| uint8_t a5; |
| uint8_t a6; |
| uint8_t a7; |
| uint8_t a8; |
| }; |
| |
| struct Struct9BytesInt4Or8ByteAligned { |
| int64_t a0; |
| int8_t a1; |
| }; |
| |
| struct Struct10BytesHomogeneousBool { |
| bool a0; |
| bool a1; |
| bool a2; |
| bool a3; |
| bool a4; |
| bool a5; |
| bool a6; |
| bool a7; |
| bool a8; |
| bool a9; |
| }; |
| |
| struct Struct12BytesHomogeneousFloat { |
| float a0; |
| float a1; |
| float a2; |
| }; |
| |
| struct Struct12BytesHomogeneousInt32 { |
| int32_t a0; |
| int32_t a1; |
| int32_t a2; |
| }; |
| |
| struct Struct16BytesHomogeneousFloat { |
| float a0; |
| float a1; |
| float a2; |
| float a3; |
| }; |
| |
| struct Struct16BytesMixed { |
| double a0; |
| int64_t a1; |
| }; |
| |
| struct Struct16BytesMixed2 { |
| float a0; |
| float a1; |
| float a2; |
| int32_t a3; |
| }; |
| |
| struct Struct17BytesInt { |
| int64_t a0; |
| int64_t a1; |
| int8_t a2; |
| }; |
| |
| struct Struct19BytesHomogeneousUint8 { |
| uint8_t a0; |
| uint8_t a1; |
| uint8_t a2; |
| uint8_t a3; |
| uint8_t a4; |
| uint8_t a5; |
| uint8_t a6; |
| uint8_t a7; |
| uint8_t a8; |
| uint8_t a9; |
| uint8_t a10; |
| uint8_t a11; |
| uint8_t a12; |
| uint8_t a13; |
| uint8_t a14; |
| uint8_t a15; |
| uint8_t a16; |
| uint8_t a17; |
| uint8_t a18; |
| }; |
| |
| struct Struct20BytesHomogeneousInt32 { |
| int32_t a0; |
| int32_t a1; |
| int32_t a2; |
| int32_t a3; |
| int32_t a4; |
| }; |
| |
| struct Struct20BytesHomogeneousFloat { |
| float a0; |
| float a1; |
| float a2; |
| float a3; |
| float a4; |
| }; |
| |
| struct Struct32BytesHomogeneousDouble { |
| double a0; |
| double a1; |
| double a2; |
| double a3; |
| }; |
| |
| struct Struct40BytesHomogeneousDouble { |
| double a0; |
| double a1; |
| double a2; |
| double a3; |
| double a4; |
| }; |
| |
| struct Struct1024BytesHomogeneousUint64 { |
| uint64_t a0; |
| uint64_t a1; |
| uint64_t a2; |
| uint64_t a3; |
| uint64_t a4; |
| uint64_t a5; |
| uint64_t a6; |
| uint64_t a7; |
| uint64_t a8; |
| uint64_t a9; |
| uint64_t a10; |
| uint64_t a11; |
| uint64_t a12; |
| uint64_t a13; |
| uint64_t a14; |
| uint64_t a15; |
| uint64_t a16; |
| uint64_t a17; |
| uint64_t a18; |
| uint64_t a19; |
| uint64_t a20; |
| uint64_t a21; |
| uint64_t a22; |
| uint64_t a23; |
| uint64_t a24; |
| uint64_t a25; |
| uint64_t a26; |
| uint64_t a27; |
| uint64_t a28; |
| uint64_t a29; |
| uint64_t a30; |
| uint64_t a31; |
| uint64_t a32; |
| uint64_t a33; |
| uint64_t a34; |
| uint64_t a35; |
| uint64_t a36; |
| uint64_t a37; |
| uint64_t a38; |
| uint64_t a39; |
| uint64_t a40; |
| uint64_t a41; |
| uint64_t a42; |
| uint64_t a43; |
| uint64_t a44; |
| uint64_t a45; |
| uint64_t a46; |
| uint64_t a47; |
| uint64_t a48; |
| uint64_t a49; |
| uint64_t a50; |
| uint64_t a51; |
| uint64_t a52; |
| uint64_t a53; |
| uint64_t a54; |
| uint64_t a55; |
| uint64_t a56; |
| uint64_t a57; |
| uint64_t a58; |
| uint64_t a59; |
| uint64_t a60; |
| uint64_t a61; |
| uint64_t a62; |
| uint64_t a63; |
| uint64_t a64; |
| uint64_t a65; |
| uint64_t a66; |
| uint64_t a67; |
| uint64_t a68; |
| uint64_t a69; |
| uint64_t a70; |
| uint64_t a71; |
| uint64_t a72; |
| uint64_t a73; |
| uint64_t a74; |
| uint64_t a75; |
| uint64_t a76; |
| uint64_t a77; |
| uint64_t a78; |
| uint64_t a79; |
| uint64_t a80; |
| uint64_t a81; |
| uint64_t a82; |
| uint64_t a83; |
| uint64_t a84; |
| uint64_t a85; |
| uint64_t a86; |
| uint64_t a87; |
| uint64_t a88; |
| uint64_t a89; |
| uint64_t a90; |
| uint64_t a91; |
| uint64_t a92; |
| uint64_t a93; |
| uint64_t a94; |
| uint64_t a95; |
| uint64_t a96; |
| uint64_t a97; |
| uint64_t a98; |
| uint64_t a99; |
| uint64_t a100; |
| uint64_t a101; |
| uint64_t a102; |
| uint64_t a103; |
| uint64_t a104; |
| uint64_t a105; |
| uint64_t a106; |
| uint64_t a107; |
| uint64_t a108; |
| uint64_t a109; |
| uint64_t a110; |
| uint64_t a111; |
| uint64_t a112; |
| uint64_t a113; |
| uint64_t a114; |
| uint64_t a115; |
| uint64_t a116; |
| uint64_t a117; |
| uint64_t a118; |
| uint64_t a119; |
| uint64_t a120; |
| uint64_t a121; |
| uint64_t a122; |
| uint64_t a123; |
| uint64_t a124; |
| uint64_t a125; |
| uint64_t a126; |
| uint64_t a127; |
| }; |
| |
| struct StructAlignmentInt16 { |
| int8_t a0; |
| int16_t a1; |
| int8_t a2; |
| }; |
| |
| struct StructAlignmentInt32 { |
| int8_t a0; |
| int32_t a1; |
| int8_t a2; |
| }; |
| |
| struct StructAlignmentInt64 { |
| int8_t a0; |
| int64_t a1; |
| int8_t a2; |
| }; |
| |
| struct Struct8BytesNestedInt { |
| Struct4BytesHomogeneousInt16 a0; |
| Struct4BytesHomogeneousInt16 a1; |
| }; |
| |
| struct Struct8BytesNestedFloat { |
| Struct4BytesFloat a0; |
| Struct4BytesFloat a1; |
| }; |
| |
| struct Struct8BytesNestedFloat2 { |
| Struct4BytesFloat a0; |
| float a1; |
| }; |
| |
| struct Struct8BytesNestedMixed { |
| Struct4BytesHomogeneousInt16 a0; |
| Struct4BytesFloat a1; |
| }; |
| |
| struct Struct16BytesNestedInt { |
| Struct8BytesNestedInt a0; |
| Struct8BytesNestedInt a1; |
| }; |
| |
| struct Struct32BytesNestedInt { |
| Struct16BytesNestedInt a0; |
| Struct16BytesNestedInt a1; |
| }; |
| |
| struct StructNestedIntStructAlignmentInt16 { |
| StructAlignmentInt16 a0; |
| StructAlignmentInt16 a1; |
| }; |
| |
| struct StructNestedIntStructAlignmentInt32 { |
| StructAlignmentInt32 a0; |
| StructAlignmentInt32 a1; |
| }; |
| |
| struct StructNestedIntStructAlignmentInt64 { |
| StructAlignmentInt64 a0; |
| StructAlignmentInt64 a1; |
| }; |
| |
| struct StructNestedIrregularBig { |
| uint16_t a0; |
| Struct8BytesNestedMixed a1; |
| uint16_t a2; |
| Struct8BytesNestedFloat2 a3; |
| uint16_t a4; |
| Struct8BytesNestedFloat a5; |
| uint16_t a6; |
| }; |
| |
| struct StructNestedIrregularBigger { |
| StructNestedIrregularBig a0; |
| Struct8BytesNestedMixed a1; |
| float a2; |
| double a3; |
| }; |
| |
| struct StructNestedIrregularEvenBigger { |
| uint64_t a0; |
| StructNestedIrregularBigger a1; |
| StructNestedIrregularBigger a2; |
| double a3; |
| }; |
| |
| struct Struct8BytesInlineArrayInt { |
| uint8_t a0[8]; |
| }; |
| |
| struct Struct10BytesInlineArrayBool { |
| bool a0[10]; |
| }; |
| |
| struct StructInlineArrayIrregular { |
| Struct3BytesInt2ByteAligned a0[2]; |
| uint8_t a1; |
| }; |
| |
| struct StructInlineArray100Bytes { |
| uint8_t a0[100]; |
| }; |
| |
| struct StructInlineArrayBig { |
| uint32_t a0; |
| uint32_t a1; |
| uint8_t a2[4000]; |
| }; |
| |
| struct StructStruct16BytesHomogeneousFloat2 { |
| Struct4BytesFloat a0; |
| Struct4BytesFloat a1[2]; |
| float a2; |
| }; |
| |
| struct StructStruct32BytesHomogeneousDouble2 { |
| Struct8BytesFloat a0; |
| Struct8BytesFloat a1[2]; |
| double a2; |
| }; |
| |
| struct StructStruct16BytesMixed3 { |
| Struct4BytesFloat a0; |
| Struct8BytesMixed a1[1]; |
| int16_t a2[2]; |
| }; |
| |
| struct Struct8BytesInlineArrayMultiDimensionalInt { |
| uint8_t a0[2][2][2]; |
| }; |
| |
| struct Struct32BytesInlineArrayMultiDimensionalInt { |
| uint8_t a0[2][2][2][2][2]; |
| }; |
| |
| struct Struct64BytesInlineArrayMultiDimensionalInt { |
| uint8_t a0[2][2][2][2][2][2]; |
| }; |
| |
| struct Struct4BytesInlineArrayMultiDimensionalInt { |
| Struct1ByteInt a0[2][2]; |
| }; |
| |
| #pragma pack(push, 1) |
| struct Struct3BytesPackedInt { |
| int8_t a0; |
| int16_t a1; |
| }; |
| #pragma pack(pop) |
| |
| #pragma pack(push, 1) |
| struct Struct3BytesPackedIntMembersAligned { |
| int8_t a0; |
| int16_t a1; |
| }; |
| #pragma pack(pop) |
| |
| #pragma pack(push, 1) |
| struct Struct5BytesPackedMixed { |
| float a0; |
| uint8_t a1; |
| }; |
| #pragma pack(pop) |
| |
| struct StructNestedAlignmentStruct5BytesPackedMixed { |
| uint8_t a0; |
| Struct5BytesPackedMixed a1; |
| }; |
| |
| struct Struct6BytesInlineArrayInt { |
| Struct3BytesPackedIntMembersAligned a0[2]; |
| }; |
| |
| #pragma pack(push, 1) |
| struct Struct8BytesPackedInt { |
| uint8_t a0; |
| uint32_t a1; |
| uint8_t a2; |
| uint8_t a3; |
| uint8_t a4; |
| }; |
| #pragma pack(pop) |
| |
| #pragma pack(push, 1) |
| struct Struct9BytesPackedMixed { |
| uint8_t a0; |
| double a1; |
| }; |
| #pragma pack(pop) |
| |
| struct Struct15BytesInlineArrayMixed { |
| Struct5BytesPackedMixed a0[3]; |
| }; |
| |
| union Union4BytesMixed { |
| uint32_t a0; |
| float a1; |
| }; |
| |
| union Union8BytesNestedFloat { |
| double a0; |
| Struct8BytesHomogeneousFloat a1; |
| }; |
| |
| union Union9BytesNestedInt { |
| Struct8BytesInt a0; |
| Struct9BytesHomogeneousUint8 a1; |
| }; |
| |
| union Union16BytesNestedInlineArrayFloat { |
| float a0[4]; |
| Struct16BytesHomogeneousFloat a1; |
| }; |
| |
| union Union16BytesNestedFloat { |
| Struct8BytesHomogeneousFloat a0; |
| Struct12BytesHomogeneousFloat a1; |
| Struct16BytesHomogeneousFloat a2; |
| }; |
| |
| struct StructInlineArrayInt { |
| wchar_t a0[10]; |
| }; |
| |
| // Used for testing structs and unions by value. |
| // Smallest struct with data. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t PassStruct1ByteIntx10(Struct1ByteInt a0, |
| Struct1ByteInt a1, |
| Struct1ByteInt a2, |
| Struct1ByteInt a3, |
| Struct1ByteInt a4, |
| Struct1ByteInt a5, |
| Struct1ByteInt a6, |
| Struct1ByteInt a7, |
| Struct1ByteInt a8, |
| Struct1ByteInt a9) { |
| std::cout << "PassStruct1ByteIntx10" |
| << "((" << static_cast<int>(a0.a0) << "), (" |
| << static_cast<int>(a1.a0) << "), (" << static_cast<int>(a2.a0) |
| << "), (" << static_cast<int>(a3.a0) << "), (" |
| << static_cast<int>(a4.a0) << "), (" << static_cast<int>(a5.a0) |
| << "), (" << static_cast<int>(a6.a0) << "), (" |
| << static_cast<int>(a7.a0) << "), (" << static_cast<int>(a8.a0) |
| << "), (" << static_cast<int>(a9.a0) << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a1.a0; |
| result += a2.a0; |
| result += a3.a0; |
| result += a4.a0; |
| result += a5.a0; |
| result += a6.a0; |
| result += a7.a0; |
| result += a8.a0; |
| result += a9.a0; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Not a multiple of word size, not a power of two. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t |
| PassStruct3BytesHomogeneousUint8x10(Struct3BytesHomogeneousUint8 a0, |
| Struct3BytesHomogeneousUint8 a1, |
| Struct3BytesHomogeneousUint8 a2, |
| Struct3BytesHomogeneousUint8 a3, |
| Struct3BytesHomogeneousUint8 a4, |
| Struct3BytesHomogeneousUint8 a5, |
| Struct3BytesHomogeneousUint8 a6, |
| Struct3BytesHomogeneousUint8 a7, |
| Struct3BytesHomogeneousUint8 a8, |
| Struct3BytesHomogeneousUint8 a9) { |
| std::cout << "PassStruct3BytesHomogeneousUint8x10" |
| << "((" << static_cast<int>(a0.a0) << ", " |
| << static_cast<int>(a0.a1) << ", " << static_cast<int>(a0.a2) |
| << "), (" << static_cast<int>(a1.a0) << ", " |
| << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) |
| << "), (" << static_cast<int>(a2.a0) << ", " |
| << static_cast<int>(a2.a1) << ", " << static_cast<int>(a2.a2) |
| << "), (" << static_cast<int>(a3.a0) << ", " |
| << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) |
| << "), (" << static_cast<int>(a4.a0) << ", " |
| << static_cast<int>(a4.a1) << ", " << static_cast<int>(a4.a2) |
| << "), (" << static_cast<int>(a5.a0) << ", " |
| << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) |
| << "), (" << static_cast<int>(a6.a0) << ", " |
| << static_cast<int>(a6.a1) << ", " << static_cast<int>(a6.a2) |
| << "), (" << static_cast<int>(a7.a0) << ", " |
| << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) |
| << "), (" << static_cast<int>(a8.a0) << ", " |
| << static_cast<int>(a8.a1) << ", " << static_cast<int>(a8.a2) |
| << "), (" << static_cast<int>(a9.a0) << ", " |
| << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) |
| << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Not a multiple of word size, not a power of two. |
| // With alignment rules taken into account size is 4 bytes. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t |
| PassStruct3BytesInt2ByteAlignedx10(Struct3BytesInt2ByteAligned a0, |
| Struct3BytesInt2ByteAligned a1, |
| Struct3BytesInt2ByteAligned a2, |
| Struct3BytesInt2ByteAligned a3, |
| Struct3BytesInt2ByteAligned a4, |
| Struct3BytesInt2ByteAligned a5, |
| Struct3BytesInt2ByteAligned a6, |
| Struct3BytesInt2ByteAligned a7, |
| Struct3BytesInt2ByteAligned a8, |
| Struct3BytesInt2ByteAligned a9) { |
| std::cout << "PassStruct3BytesInt2ByteAlignedx10" |
| << "((" << a0.a0 << ", " << static_cast<int>(a0.a1) << "), (" |
| << a1.a0 << ", " << static_cast<int>(a1.a1) << "), (" << a2.a0 |
| << ", " << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", " |
| << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", " |
| << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", " |
| << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", " |
| << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", " |
| << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", " |
| << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", " |
| << static_cast<int>(a9.a1) << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Exactly word size on 32-bit architectures. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t |
| PassStruct4BytesHomogeneousInt16x10(Struct4BytesHomogeneousInt16 a0, |
| Struct4BytesHomogeneousInt16 a1, |
| Struct4BytesHomogeneousInt16 a2, |
| Struct4BytesHomogeneousInt16 a3, |
| Struct4BytesHomogeneousInt16 a4, |
| Struct4BytesHomogeneousInt16 a5, |
| Struct4BytesHomogeneousInt16 a6, |
| Struct4BytesHomogeneousInt16 a7, |
| Struct4BytesHomogeneousInt16 a8, |
| Struct4BytesHomogeneousInt16 a9) { |
| std::cout << "PassStruct4BytesHomogeneousInt16x10" |
| << "((" << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " |
| << a1.a1 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 |
| << ", " << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" |
| << a5.a0 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 |
| << "), (" << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " |
| << a8.a1 << "), (" << a9.a0 << ", " << a9.a1 << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Sub word size on 64 bit architectures. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t |
| PassStruct7BytesHomogeneousUint8x10(Struct7BytesHomogeneousUint8 a0, |
| Struct7BytesHomogeneousUint8 a1, |
| Struct7BytesHomogeneousUint8 a2, |
| Struct7BytesHomogeneousUint8 a3, |
| Struct7BytesHomogeneousUint8 a4, |
| Struct7BytesHomogeneousUint8 a5, |
| Struct7BytesHomogeneousUint8 a6, |
| Struct7BytesHomogeneousUint8 a7, |
| Struct7BytesHomogeneousUint8 a8, |
| Struct7BytesHomogeneousUint8 a9) { |
| std::cout |
| << "PassStruct7BytesHomogeneousUint8x10" |
| << "((" << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) |
| << ", " << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) |
| << ", " << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) |
| << ", " << static_cast<int>(a0.a6) << "), (" << static_cast<int>(a1.a0) |
| << ", " << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) |
| << ", " << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) |
| << ", " << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) |
| << "), (" << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) |
| << ", " << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) |
| << ", " << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) |
| << ", " << static_cast<int>(a2.a6) << "), (" << static_cast<int>(a3.a0) |
| << ", " << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) |
| << ", " << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) |
| << ", " << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) |
| << "), (" << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) |
| << ", " << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) |
| << ", " << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) |
| << ", " << static_cast<int>(a4.a6) << "), (" << static_cast<int>(a5.a0) |
| << ", " << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) |
| << ", " << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) |
| << ", " << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) |
| << "), (" << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) |
| << ", " << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) |
| << ", " << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) |
| << ", " << static_cast<int>(a6.a6) << "), (" << static_cast<int>(a7.a0) |
| << ", " << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) |
| << ", " << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) |
| << ", " << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) |
| << "), (" << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) |
| << ", " << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) |
| << ", " << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) |
| << ", " << static_cast<int>(a8.a6) << "), (" << static_cast<int>(a9.a0) |
| << ", " << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) |
| << ", " << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) |
| << ", " << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) |
| << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a1.a5; |
| result += a1.a6; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a2.a5; |
| result += a2.a6; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a3.a5; |
| result += a3.a6; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a4.a5; |
| result += a4.a6; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a5.a5; |
| result += a5.a6; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a6.a5; |
| result += a6.a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a7.a5; |
| result += a7.a6; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a8.a5; |
| result += a8.a6; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| result += a9.a5; |
| result += a9.a6; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Sub word size on 64 bit architectures. |
| // With alignment rules taken into account size is 8 bytes. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t |
| PassStruct7BytesInt4ByteAlignedx10(Struct7BytesInt4ByteAligned a0, |
| Struct7BytesInt4ByteAligned a1, |
| Struct7BytesInt4ByteAligned a2, |
| Struct7BytesInt4ByteAligned a3, |
| Struct7BytesInt4ByteAligned a4, |
| Struct7BytesInt4ByteAligned a5, |
| Struct7BytesInt4ByteAligned a6, |
| Struct7BytesInt4ByteAligned a7, |
| Struct7BytesInt4ByteAligned a8, |
| Struct7BytesInt4ByteAligned a9) { |
| std::cout << "PassStruct7BytesInt4ByteAlignedx10" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) |
| << "), (" << a1.a0 << ", " << a1.a1 << ", " |
| << static_cast<int>(a1.a2) << "), (" << a2.a0 << ", " << a2.a1 |
| << ", " << static_cast<int>(a2.a2) << "), (" << a3.a0 << ", " |
| << a3.a1 << ", " << static_cast<int>(a3.a2) << "), (" << a4.a0 |
| << ", " << a4.a1 << ", " << static_cast<int>(a4.a2) << "), (" |
| << a5.a0 << ", " << a5.a1 << ", " << static_cast<int>(a5.a2) |
| << "), (" << a6.a0 << ", " << a6.a1 << ", " |
| << static_cast<int>(a6.a2) << "), (" << a7.a0 << ", " << a7.a1 |
| << ", " << static_cast<int>(a7.a2) << "), (" << a8.a0 << ", " |
| << a8.a1 << ", " << static_cast<int>(a8.a2) << "), (" << a9.a0 |
| << ", " << a9.a1 << ", " << static_cast<int>(a9.a2) << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Exactly word size struct on 64bit architectures. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT int64_t PassStruct8BytesIntx10(Struct8BytesInt a0, |
| Struct8BytesInt a1, |
| Struct8BytesInt a2, |
| Struct8BytesInt a3, |
| Struct8BytesInt a4, |
| Struct8BytesInt a5, |
| Struct8BytesInt a6, |
| Struct8BytesInt a7, |
| Struct8BytesInt a8, |
| Struct8BytesInt a9) { |
| std::cout << "PassStruct8BytesIntx10" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), (" |
| << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 |
| << ", " << a2.a1 << ", " << a2.a2 << "), (" << a3.a0 << ", " |
| << a3.a1 << ", " << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << "), (" << a5.a0 << ", " << a5.a1 << ", " |
| << a5.a2 << "), (" << a6.a0 << ", " << a6.a1 << ", " << a6.a2 |
| << "), (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << "), (" |
| << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << "), (" << a9.a0 |
| << ", " << a9.a1 << ", " << a9.a2 << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Arguments passed in FP registers as long as they fit. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT float PassStruct8BytesHomogeneousFloatx10( |
| Struct8BytesHomogeneousFloat a0, |
| Struct8BytesHomogeneousFloat a1, |
| Struct8BytesHomogeneousFloat a2, |
| Struct8BytesHomogeneousFloat a3, |
| Struct8BytesHomogeneousFloat a4, |
| Struct8BytesHomogeneousFloat a5, |
| Struct8BytesHomogeneousFloat a6, |
| Struct8BytesHomogeneousFloat a7, |
| Struct8BytesHomogeneousFloat a8, |
| Struct8BytesHomogeneousFloat a9) { |
| std::cout << "PassStruct8BytesHomogeneousFloatx10" |
| << "((" << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " |
| << a1.a1 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 |
| << ", " << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" |
| << a5.a0 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 |
| << "), (" << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " |
| << a8.a1 << "), (" << a9.a0 << ", " << a9.a1 << "))" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // On x64, arguments go in int registers because it is not only float. |
| // 10 struct arguments will exhaust available registers. |
| DART_EXPORT float PassStruct8BytesMixedx10(Struct8BytesMixed a0, |
| Struct8BytesMixed a1, |
| Struct8BytesMixed a2, |
| Struct8BytesMixed a3, |
| Struct8BytesMixed a4, |
| Struct8BytesMixed a5, |
| Struct8BytesMixed a6, |
| Struct8BytesMixed a7, |
| Struct8BytesMixed a8, |
| Struct8BytesMixed a9) { |
| std::cout << "PassStruct8BytesMixedx10" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), (" |
| << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 |
| << ", " << a2.a1 << ", " << a2.a2 << "), (" << a3.a0 << ", " |
| << a3.a1 << ", " << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << "), (" << a5.a0 << ", " << a5.a1 << ", " |
| << a5.a2 << "), (" << a6.a0 << ", " << a6.a1 << ", " << a6.a2 |
| << "), (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << "), (" |
| << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << "), (" << a9.a0 |
| << ", " << a9.a1 << ", " << a9.a2 << "))" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Argument is a single byte over a multiple of word size. |
| // 10 struct arguments will exhaust available registers. |
| // Struct only has 1-byte aligned fields to test struct alignment itself. |
| // Tests upper bytes in the integer registers that are partly filled. |
| // Tests stack alignment of non word size stack arguments. |
| DART_EXPORT int64_t |
| PassStruct9BytesHomogeneousUint8x10(Struct9BytesHomogeneousUint8 a0, |
| Struct9BytesHomogeneousUint8 a1, |
| Struct9BytesHomogeneousUint8 a2, |
| Struct9BytesHomogeneousUint8 a3, |
| Struct9BytesHomogeneousUint8 a4, |
| Struct9BytesHomogeneousUint8 a5, |
| Struct9BytesHomogeneousUint8 a6, |
| Struct9BytesHomogeneousUint8 a7, |
| Struct9BytesHomogeneousUint8 a8, |
| Struct9BytesHomogeneousUint8 a9) { |
| std::cout |
| << "PassStruct9BytesHomogeneousUint8x10" |
| << "((" << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) |
| << ", " << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) |
| << ", " << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) |
| << ", " << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) |
| << ", " << static_cast<int>(a0.a8) << "), (" << static_cast<int>(a1.a0) |
| << ", " << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) |
| << ", " << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) |
| << ", " << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) |
| << ", " << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) |
| << "), (" << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) |
| << ", " << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) |
| << ", " << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) |
| << ", " << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) |
| << ", " << static_cast<int>(a2.a8) << "), (" << static_cast<int>(a3.a0) |
| << ", " << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) |
| << ", " << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) |
| << ", " << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) |
| << ", " << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) |
| << "), (" << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) |
| << ", " << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) |
| << ", " << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) |
| << ", " << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) |
| << ", " << static_cast<int>(a4.a8) << "), (" << static_cast<int>(a5.a0) |
| << ", " << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) |
| << ", " << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) |
| << ", " << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) |
| << ", " << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) |
| << "), (" << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) |
| << ", " << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) |
| << ", " << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) |
| << ", " << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) |
| << ", " << static_cast<int>(a6.a8) << "), (" << static_cast<int>(a7.a0) |
| << ", " << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) |
| << ", " << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) |
| << ", " << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) |
| << ", " << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) |
| << "), (" << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) |
| << ", " << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) |
| << ", " << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) |
| << ", " << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) |
| << ", " << static_cast<int>(a8.a8) << "), (" << static_cast<int>(a9.a0) |
| << ", " << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) |
| << ", " << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) |
| << ", " << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) |
| << ", " << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) |
| << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a0.a7; |
| result += a0.a8; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a1.a5; |
| result += a1.a6; |
| result += a1.a7; |
| result += a1.a8; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a2.a5; |
| result += a2.a6; |
| result += a2.a7; |
| result += a2.a8; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a3.a5; |
| result += a3.a6; |
| result += a3.a7; |
| result += a3.a8; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a4.a5; |
| result += a4.a6; |
| result += a4.a7; |
| result += a4.a8; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a5.a5; |
| result += a5.a6; |
| result += a5.a7; |
| result += a5.a8; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a6.a5; |
| result += a6.a6; |
| result += a6.a7; |
| result += a6.a8; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a7.a5; |
| result += a7.a6; |
| result += a7.a7; |
| result += a7.a8; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a8.a5; |
| result += a8.a6; |
| result += a8.a7; |
| result += a8.a8; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| result += a9.a5; |
| result += a9.a6; |
| result += a9.a7; |
| result += a9.a8; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Argument is a single byte over a multiple of word size. |
| // With alignment rules taken into account size is 12 or 16 bytes. |
| // 10 struct arguments will exhaust available registers. |
| // |
| DART_EXPORT int64_t |
| PassStruct9BytesInt4Or8ByteAlignedx10(Struct9BytesInt4Or8ByteAligned a0, |
| Struct9BytesInt4Or8ByteAligned a1, |
| Struct9BytesInt4Or8ByteAligned a2, |
| Struct9BytesInt4Or8ByteAligned a3, |
| Struct9BytesInt4Or8ByteAligned a4, |
| Struct9BytesInt4Or8ByteAligned a5, |
| Struct9BytesInt4Or8ByteAligned a6, |
| Struct9BytesInt4Or8ByteAligned a7, |
| Struct9BytesInt4Or8ByteAligned a8, |
| Struct9BytesInt4Or8ByteAligned a9) { |
| std::cout << "PassStruct9BytesInt4Or8ByteAlignedx10" |
| << "((" << a0.a0 << ", " << static_cast<int>(a0.a1) << "), (" |
| << a1.a0 << ", " << static_cast<int>(a1.a1) << "), (" << a2.a0 |
| << ", " << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", " |
| << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", " |
| << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", " |
| << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", " |
| << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", " |
| << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", " |
| << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", " |
| << static_cast<int>(a9.a1) << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Arguments in FPU registers on arm hardfp and arm64. |
| // Struct arguments will exhaust available registers, and leave some empty. |
| // The last argument is to test whether arguments are backfilled. |
| DART_EXPORT float PassStruct12BytesHomogeneousFloatx6( |
| Struct12BytesHomogeneousFloat a0, |
| Struct12BytesHomogeneousFloat a1, |
| Struct12BytesHomogeneousFloat a2, |
| Struct12BytesHomogeneousFloat a3, |
| Struct12BytesHomogeneousFloat a4, |
| Struct12BytesHomogeneousFloat a5) { |
| std::cout << "PassStruct12BytesHomogeneousFloatx6" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), (" |
| << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 |
| << ", " << a2.a1 << ", " << a2.a2 << "), (" << a3.a0 << ", " |
| << a3.a1 << ", " << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << "), (" << a5.a0 << ", " << a5.a1 << ", " |
| << a5.a2 << "))" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // On Linux x64 argument is transferred on stack because it is over 16 bytes. |
| // Arguments in FPU registers on arm hardfp and arm64. |
| // 5 struct arguments will exhaust available registers. |
| DART_EXPORT float PassStruct16BytesHomogeneousFloatx5( |
| Struct16BytesHomogeneousFloat a0, |
| Struct16BytesHomogeneousFloat a1, |
| Struct16BytesHomogeneousFloat a2, |
| Struct16BytesHomogeneousFloat a3, |
| Struct16BytesHomogeneousFloat a4) { |
| std::cout << "PassStruct16BytesHomogeneousFloatx5" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " |
| << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2 |
| << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", " |
| << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << ", " << a4.a3 << "))" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // On x64, arguments are split over FP and int registers. |
| // On x64, it will exhaust the integer registers with the 6th argument. |
| // The rest goes on the stack. |
| // On arm, arguments are 8 byte aligned. |
| DART_EXPORT double PassStruct16BytesMixedx10(Struct16BytesMixed a0, |
| Struct16BytesMixed a1, |
| Struct16BytesMixed a2, |
| Struct16BytesMixed a3, |
| Struct16BytesMixed a4, |
| Struct16BytesMixed a5, |
| Struct16BytesMixed a6, |
| Struct16BytesMixed a7, |
| Struct16BytesMixed a8, |
| Struct16BytesMixed a9) { |
| std::cout << "PassStruct16BytesMixedx10" |
| << "((" << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " |
| << a1.a1 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 |
| << ", " << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" |
| << a5.a0 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 |
| << "), (" << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " |
| << a8.a1 << "), (" << a9.a0 << ", " << a9.a1 << "))" |
| << "\n"; |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a1.a0; |
| result += a1.a1; |
| result += a2.a0; |
| result += a2.a1; |
| result += a3.a0; |
| result += a3.a1; |
| result += a4.a0; |
| result += a4.a1; |
| result += a5.a0; |
| result += a5.a1; |
| result += a6.a0; |
| result += a6.a1; |
| result += a7.a0; |
| result += a7.a1; |
| result += a8.a0; |
| result += a8.a1; |
| result += a9.a0; |
| result += a9.a1; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // On x64, arguments are split over FP and int registers. |
| // On x64, it will exhaust the integer registers with the 6th argument. |
| // The rest goes on the stack. |
| // On arm, arguments are 4 byte aligned. |
| DART_EXPORT float PassStruct16BytesMixed2x10(Struct16BytesMixed2 a0, |
| Struct16BytesMixed2 a1, |
| Struct16BytesMixed2 a2, |
| Struct16BytesMixed2 a3, |
| Struct16BytesMixed2 a4, |
| Struct16BytesMixed2 a5, |
| Struct16BytesMixed2 a6, |
| Struct16BytesMixed2 a7, |
| Struct16BytesMixed2 a8, |
| Struct16BytesMixed2 a9) { |
| std::cout << "PassStruct16BytesMixed2x10" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " |
| << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2 |
| << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", " |
| << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << ", " << a4.a3 << "), (" << a5.a0 << ", " |
| << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), (" << a6.a0 |
| << ", " << a6.a1 << ", " << a6.a2 << ", " << a6.a3 << "), (" |
| << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 |
| << "), (" << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", " |
| << a8.a3 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2 |
| << ", " << a9.a3 << "))" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Arguments are passed as pointer to copy on arm64. |
| // Tests that the memory allocated for copies are rounded up to word size. |
| DART_EXPORT int64_t PassStruct17BytesIntx10(Struct17BytesInt a0, |
| Struct17BytesInt a1, |
| Struct17BytesInt a2, |
| Struct17BytesInt a3, |
| Struct17BytesInt a4, |
| Struct17BytesInt a5, |
| Struct17BytesInt a6, |
| Struct17BytesInt a7, |
| Struct17BytesInt a8, |
| Struct17BytesInt a9) { |
| std::cout << "PassStruct17BytesIntx10" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) |
| << "), (" << a1.a0 << ", " << a1.a1 << ", " |
| << static_cast<int>(a1.a2) << "), (" << a2.a0 << ", " << a2.a1 |
| << ", " << static_cast<int>(a2.a2) << "), (" << a3.a0 << ", " |
| << a3.a1 << ", " << static_cast<int>(a3.a2) << "), (" << a4.a0 |
| << ", " << a4.a1 << ", " << static_cast<int>(a4.a2) << "), (" |
| << a5.a0 << ", " << a5.a1 << ", " << static_cast<int>(a5.a2) |
| << "), (" << a6.a0 << ", " << a6.a1 << ", " |
| << static_cast<int>(a6.a2) << "), (" << a7.a0 << ", " << a7.a1 |
| << ", " << static_cast<int>(a7.a2) << "), (" << a8.a0 << ", " |
| << a8.a1 << ", " << static_cast<int>(a8.a2) << "), (" << a9.a0 |
| << ", " << a9.a1 << ", " << static_cast<int>(a9.a2) << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // The minimum alignment of this struct is only 1 byte based on its fields. |
| // Test that the memory backing these structs is extended to the right size. |
| // |
| DART_EXPORT int64_t |
| PassStruct19BytesHomogeneousUint8x10(Struct19BytesHomogeneousUint8 a0, |
| Struct19BytesHomogeneousUint8 a1, |
| Struct19BytesHomogeneousUint8 a2, |
| Struct19BytesHomogeneousUint8 a3, |
| Struct19BytesHomogeneousUint8 a4, |
| Struct19BytesHomogeneousUint8 a5, |
| Struct19BytesHomogeneousUint8 a6, |
| Struct19BytesHomogeneousUint8 a7, |
| Struct19BytesHomogeneousUint8 a8, |
| Struct19BytesHomogeneousUint8 a9) { |
| std::cout |
| << "PassStruct19BytesHomogeneousUint8x10" |
| << "((" << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) |
| << ", " << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) |
| << ", " << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) |
| << ", " << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) |
| << ", " << static_cast<int>(a0.a8) << ", " << static_cast<int>(a0.a9) |
| << ", " << static_cast<int>(a0.a10) << ", " << static_cast<int>(a0.a11) |
| << ", " << static_cast<int>(a0.a12) << ", " << static_cast<int>(a0.a13) |
| << ", " << static_cast<int>(a0.a14) << ", " << static_cast<int>(a0.a15) |
| << ", " << static_cast<int>(a0.a16) << ", " << static_cast<int>(a0.a17) |
| << ", " << static_cast<int>(a0.a18) << "), (" << static_cast<int>(a1.a0) |
| << ", " << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) |
| << ", " << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) |
| << ", " << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) |
| << ", " << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) |
| << ", " << static_cast<int>(a1.a9) << ", " << static_cast<int>(a1.a10) |
| << ", " << static_cast<int>(a1.a11) << ", " << static_cast<int>(a1.a12) |
| << ", " << static_cast<int>(a1.a13) << ", " << static_cast<int>(a1.a14) |
| << ", " << static_cast<int>(a1.a15) << ", " << static_cast<int>(a1.a16) |
| << ", " << static_cast<int>(a1.a17) << ", " << static_cast<int>(a1.a18) |
| << "), (" << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) |
| << ", " << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) |
| << ", " << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) |
| << ", " << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) |
| << ", " << static_cast<int>(a2.a8) << ", " << static_cast<int>(a2.a9) |
| << ", " << static_cast<int>(a2.a10) << ", " << static_cast<int>(a2.a11) |
| << ", " << static_cast<int>(a2.a12) << ", " << static_cast<int>(a2.a13) |
| << ", " << static_cast<int>(a2.a14) << ", " << static_cast<int>(a2.a15) |
| << ", " << static_cast<int>(a2.a16) << ", " << static_cast<int>(a2.a17) |
| << ", " << static_cast<int>(a2.a18) << "), (" << static_cast<int>(a3.a0) |
| << ", " << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) |
| << ", " << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) |
| << ", " << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) |
| << ", " << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) |
| << ", " << static_cast<int>(a3.a9) << ", " << static_cast<int>(a3.a10) |
| << ", " << static_cast<int>(a3.a11) << ", " << static_cast<int>(a3.a12) |
| << ", " << static_cast<int>(a3.a13) << ", " << static_cast<int>(a3.a14) |
| << ", " << static_cast<int>(a3.a15) << ", " << static_cast<int>(a3.a16) |
| << ", " << static_cast<int>(a3.a17) << ", " << static_cast<int>(a3.a18) |
| << "), (" << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) |
| << ", " << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) |
| << ", " << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) |
| << ", " << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) |
| << ", " << static_cast<int>(a4.a8) << ", " << static_cast<int>(a4.a9) |
| << ", " << static_cast<int>(a4.a10) << ", " << static_cast<int>(a4.a11) |
| << ", " << static_cast<int>(a4.a12) << ", " << static_cast<int>(a4.a13) |
| << ", " << static_cast<int>(a4.a14) << ", " << static_cast<int>(a4.a15) |
| << ", " << static_cast<int>(a4.a16) << ", " << static_cast<int>(a4.a17) |
| << ", " << static_cast<int>(a4.a18) << "), (" << static_cast<int>(a5.a0) |
| << ", " << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) |
| << ", " << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) |
| << ", " << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) |
| << ", " << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) |
| << ", " << static_cast<int>(a5.a9) << ", " << static_cast<int>(a5.a10) |
| << ", " << static_cast<int>(a5.a11) << ", " << static_cast<int>(a5.a12) |
| << ", " << static_cast<int>(a5.a13) << ", " << static_cast<int>(a5.a14) |
| << ", " << static_cast<int>(a5.a15) << ", " << static_cast<int>(a5.a16) |
| << ", " << static_cast<int>(a5.a17) << ", " << static_cast<int>(a5.a18) |
| << "), (" << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) |
| << ", " << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) |
| << ", " << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) |
| << ", " << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) |
| << ", " << static_cast<int>(a6.a8) << ", " << static_cast<int>(a6.a9) |
| << ", " << static_cast<int>(a6.a10) << ", " << static_cast<int>(a6.a11) |
| << ", " << static_cast<int>(a6.a12) << ", " << static_cast<int>(a6.a13) |
| << ", " << static_cast<int>(a6.a14) << ", " << static_cast<int>(a6.a15) |
| << ", " << static_cast<int>(a6.a16) << ", " << static_cast<int>(a6.a17) |
| << ", " << static_cast<int>(a6.a18) << "), (" << static_cast<int>(a7.a0) |
| << ", " << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) |
| << ", " << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) |
| << ", " << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) |
| << ", " << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) |
| << ", " << static_cast<int>(a7.a9) << ", " << static_cast<int>(a7.a10) |
| << ", " << static_cast<int>(a7.a11) << ", " << static_cast<int>(a7.a12) |
| << ", " << static_cast<int>(a7.a13) << ", " << static_cast<int>(a7.a14) |
| << ", " << static_cast<int>(a7.a15) << ", " << static_cast<int>(a7.a16) |
| << ", " << static_cast<int>(a7.a17) << ", " << static_cast<int>(a7.a18) |
| << "), (" << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) |
| << ", " << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) |
| << ", " << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) |
| << ", " << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) |
| << ", " << static_cast<int>(a8.a8) << ", " << static_cast<int>(a8.a9) |
| << ", " << static_cast<int>(a8.a10) << ", " << static_cast<int>(a8.a11) |
| << ", " << static_cast<int>(a8.a12) << ", " << static_cast<int>(a8.a13) |
| << ", " << static_cast<int>(a8.a14) << ", " << static_cast<int>(a8.a15) |
| << ", " << static_cast<int>(a8.a16) << ", " << static_cast<int>(a8.a17) |
| << ", " << static_cast<int>(a8.a18) << "), (" << static_cast<int>(a9.a0) |
| << ", " << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) |
| << ", " << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) |
| << ", " << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) |
| << ", " << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) |
| << ", " << static_cast<int>(a9.a9) << ", " << static_cast<int>(a9.a10) |
| << ", " << static_cast<int>(a9.a11) << ", " << static_cast<int>(a9.a12) |
| << ", " << static_cast<int>(a9.a13) << ", " << static_cast<int>(a9.a14) |
| << ", " << static_cast<int>(a9.a15) << ", " << static_cast<int>(a9.a16) |
| << ", " << static_cast<int>(a9.a17) << ", " << static_cast<int>(a9.a18) |
| << "))" |
| << "\n"; |
| |
| int64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a0.a7; |
| result += a0.a8; |
| result += a0.a9; |
| result += a0.a10; |
| result += a0.a11; |
| result += a0.a12; |
| result += a0.a13; |
| result += a0.a14; |
| result += a0.a15; |
| result += a0.a16; |
| result += a0.a17; |
| result += a0.a18; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a1.a5; |
| result += a1.a6; |
| result += a1.a7; |
| result += a1.a8; |
| result += a1.a9; |
| result += a1.a10; |
| result += a1.a11; |
| result += a1.a12; |
| result += a1.a13; |
| result += a1.a14; |
| result += a1.a15; |
| result += a1.a16; |
| result += a1.a17; |
| result += a1.a18; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a2.a5; |
| result += a2.a6; |
| result += a2.a7; |
| result += a2.a8; |
| result += a2.a9; |
| result += a2.a10; |
| result += a2.a11; |
| result += a2.a12; |
| result += a2.a13; |
| result += a2.a14; |
| result += a2.a15; |
| result += a2.a16; |
| result += a2.a17; |
| result += a2.a18; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a3.a5; |
| result += a3.a6; |
| result += a3.a7; |
| result += a3.a8; |
| result += a3.a9; |
| result += a3.a10; |
| result += a3.a11; |
| result += a3.a12; |
| result += a3.a13; |
| result += a3.a14; |
| result += a3.a15; |
| result += a3.a16; |
| result += a3.a17; |
| result += a3.a18; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a4.a5; |
| result += a4.a6; |
| result += a4.a7; |
| result += a4.a8; |
| result += a4.a9; |
| result += a4.a10; |
| result += a4.a11; |
| result += a4.a12; |
| result += a4.a13; |
| result += a4.a14; |
| result += a4.a15; |
| result += a4.a16; |
| result += a4.a17; |
| result += a4.a18; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a5.a5; |
| result += a5.a6; |
| result += a5.a7; |
| result += a5.a8; |
| result += a5.a9; |
| result += a5.a10; |
| result += a5.a11; |
| result += a5.a12; |
| result += a5.a13; |
| result += a5.a14; |
| result += a5.a15; |
| result += a5.a16; |
| result += a5.a17; |
| result += a5.a18; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a6.a5; |
| result += a6.a6; |
| result += a6.a7; |
| result += a6.a8; |
| result += a6.a9; |
| result += a6.a10; |
| result += a6.a11; |
| result += a6.a12; |
| result += a6.a13; |
| result += a6.a14; |
| result += a6.a15; |
| result += a6.a16; |
| result += a6.a17; |
| result += a6.a18; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a7.a5; |
| result += a7.a6; |
| result += a7.a7; |
| result += a7.a8; |
| result += a7.a9; |
| result += a7.a10; |
| result += a7.a11; |
| result += a7.a12; |
| result += a7.a13; |
| result += a7.a14; |
| result += a7.a15; |
| result += a7.a16; |
| result += a7.a17; |
| result += a7.a18; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a8.a5; |
| result += a8.a6; |
| result += a8.a7; |
| result += a8.a8; |
| result += a8.a9; |
| result += a8.a10; |
| result += a8.a11; |
| result += a8.a12; |
| result += a8.a13; |
| result += a8.a14; |
| result += a8.a15; |
| result += a8.a16; |
| result += a8.a17; |
| result += a8.a18; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| result += a9.a5; |
| result += a9.a6; |
| result += a9.a7; |
| result += a9.a8; |
| result += a9.a9; |
| result += a9.a10; |
| result += a9.a11; |
| result += a9.a12; |
| result += a9.a13; |
| result += a9.a14; |
| result += a9.a15; |
| result += a9.a16; |
| result += a9.a17; |
| result += a9.a18; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Argument too big to go into integer registers on arm64. |
| // The arguments are passed as pointers to copies. |
| // The amount of arguments exhausts the number of integer registers, such that |
| // pointers to copies are also passed on the stack. |
| DART_EXPORT int32_t |
| PassStruct20BytesHomogeneousInt32x10(Struct20BytesHomogeneousInt32 a0, |
| Struct20BytesHomogeneousInt32 a1, |
| Struct20BytesHomogeneousInt32 a2, |
| Struct20BytesHomogeneousInt32 a3, |
| Struct20BytesHomogeneousInt32 a4, |
| Struct20BytesHomogeneousInt32 a5, |
| Struct20BytesHomogeneousInt32 a6, |
| Struct20BytesHomogeneousInt32 a7, |
| Struct20BytesHomogeneousInt32 a8, |
| Struct20BytesHomogeneousInt32 a9) { |
| std::cout << "PassStruct20BytesHomogeneousInt32x10" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << ", " << a0.a4 << "), (" << a1.a0 << ", " << a1.a1 << ", " |
| << a1.a2 << ", " << a1.a3 << ", " << a1.a4 << "), (" << a2.a0 |
| << ", " << a2.a1 << ", " << a2.a2 << ", " << a2.a3 << ", " << a2.a4 |
| << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", " |
| << a3.a3 << ", " << a3.a4 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << ", " << a4.a3 << ", " << a4.a4 << "), (" |
| << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << ", " |
| << a5.a4 << "), (" << a6.a0 << ", " << a6.a1 << ", " << a6.a2 |
| << ", " << a6.a3 << ", " << a6.a4 << "), (" << a7.a0 << ", " |
| << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << ", " << a7.a4 |
| << "), (" << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", " |
| << a8.a3 << ", " << a8.a4 << "), (" << a9.a0 << ", " << a9.a1 |
| << ", " << a9.a2 << ", " << a9.a3 << ", " << a9.a4 << "))" |
| << "\n"; |
| |
| int32_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a1.a4; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a2.a4; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a3.a4; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| result += a4.a4; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a5.a4; |
| result += a6.a0; |
| result += a6.a1; |
| result += a6.a2; |
| result += a6.a3; |
| result += a6.a4; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a7.a4; |
| result += a8.a0; |
| result += a8.a1; |
| result += a8.a2; |
| result += a8.a3; |
| result += a8.a4; |
| result += a9.a0; |
| result += a9.a1; |
| result += a9.a2; |
| result += a9.a3; |
| result += a9.a4; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Argument too big to go into FPU registers in hardfp and arm64. |
| DART_EXPORT float PassStruct20BytesHomogeneousFloat( |
| Struct20BytesHomogeneousFloat a0) { |
| std::cout << "PassStruct20BytesHomogeneousFloat" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << ", " << a0.a4 << "))" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Arguments in FPU registers on arm64. |
| // 5 struct arguments will exhaust available registers. |
| DART_EXPORT double PassStruct32BytesHomogeneousDoublex5( |
| Struct32BytesHomogeneousDouble a0, |
| Struct32BytesHomogeneousDouble a1, |
| Struct32BytesHomogeneousDouble a2, |
| Struct32BytesHomogeneousDouble a3, |
| Struct32BytesHomogeneousDouble a4) { |
| std::cout << "PassStruct32BytesHomogeneousDoublex5" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " |
| << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2 |
| << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", " |
| << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 |
| << ", " << a4.a2 << ", " << a4.a3 << "))" |
| << "\n"; |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2.a0; |
| result += a2.a1; |
| result += a2.a2; |
| result += a2.a3; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4.a0; |
| result += a4.a1; |
| result += a4.a2; |
| result += a4.a3; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Argument too big to go into FPU registers in arm64. |
| DART_EXPORT double PassStruct40BytesHomogeneousDouble( |
| Struct40BytesHomogeneousDouble a0) { |
| std::cout << "PassStruct40BytesHomogeneousDouble" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << ", " << a0.a4 << "))" |
| << "\n"; |
| |
| double result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Test 1kb struct. |
| DART_EXPORT uint64_t |
| PassStruct1024BytesHomogeneousUint64(Struct1024BytesHomogeneousUint64 a0) { |
| std::cout << "PassStruct1024BytesHomogeneousUint64" |
| << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 |
| << ", " << a0.a4 << ", " << a0.a5 << ", " << a0.a6 << ", " << a0.a7 |
| << ", " << a0.a8 << ", " << a0.a9 << ", " << a0.a10 << ", " |
| << a0.a11 << ", " << a0.a12 << ", " << a0.a13 << ", " << a0.a14 |
| << ", " << a0.a15 << ", " << a0.a16 << ", " << a0.a17 << ", " |
| << a0.a18 << ", " << a0.a19 << ", " << a0.a20 << ", " << a0.a21 |
| << ", " << a0.a22 << ", " << a0.a23 << ", " << a0.a24 << ", " |
| << a0.a25 << ", " << a0.a26 << ", " << a0.a27 << ", " << a0.a28 |
| << ", " << a0.a29 << ", " << a0.a30 << ", " << a0.a31 << ", " |
| << a0.a32 << ", " << a0.a33 << ", " << a0.a34 << ", " << a0.a35 |
| << ", " << a0.a36 << ", " << a0.a37 << ", " << a0.a38 << ", " |
| << a0.a39 << ", " << a0.a40 << ", " << a0.a41 << ", " << a0.a42 |
| << ", " << a0.a43 << ", " << a0.a44 << ", " << a0.a45 << ", " |
| << a0.a46 << ", " << a0.a47 << ", " << a0.a48 << ", " << a0.a49 |
| << ", " << a0.a50 << ", " << a0.a51 << ", " << a0.a52 << ", " |
| << a0.a53 << ", " << a0.a54 << ", " << a0.a55 << ", " << a0.a56 |
| << ", " << a0.a57 << ", " << a0.a58 << ", " << a0.a59 << ", " |
| << a0.a60 << ", " << a0.a61 << ", " << a0.a62 << ", " << a0.a63 |
| << ", " << a0.a64 << ", " << a0.a65 << ", " << a0.a66 << ", " |
| << a0.a67 << ", " << a0.a68 << ", " << a0.a69 << ", " << a0.a70 |
| << ", " << a0.a71 << ", " << a0.a72 << ", " << a0.a73 << ", " |
| << a0.a74 << ", " << a0.a75 << ", " << a0.a76 << ", " << a0.a77 |
| << ", " << a0.a78 << ", " << a0.a79 << ", " << a0.a80 << ", " |
| << a0.a81 << ", " << a0.a82 << ", " << a0.a83 << ", " << a0.a84 |
| << ", " << a0.a85 << ", " << a0.a86 << ", " << a0.a87 << ", " |
| << a0.a88 << ", " << a0.a89 << ", " << a0.a90 << ", " << a0.a91 |
| << ", " << a0.a92 << ", " << a0.a93 << ", " << a0.a94 << ", " |
| << a0.a95 << ", " << a0.a96 << ", " << a0.a97 << ", " << a0.a98 |
| << ", " << a0.a99 << ", " << a0.a100 << ", " << a0.a101 << ", " |
| << a0.a102 << ", " << a0.a103 << ", " << a0.a104 << ", " << a0.a105 |
| << ", " << a0.a106 << ", " << a0.a107 << ", " << a0.a108 << ", " |
| << a0.a109 << ", " << a0.a110 << ", " << a0.a111 << ", " << a0.a112 |
| << ", " << a0.a113 << ", " << a0.a114 << ", " << a0.a115 << ", " |
| << a0.a116 << ", " << a0.a117 << ", " << a0.a118 << ", " << a0.a119 |
| << ", " << a0.a120 << ", " << a0.a121 << ", " << a0.a122 << ", " |
| << a0.a123 << ", " << a0.a124 << ", " << a0.a125 << ", " << a0.a126 |
| << ", " << a0.a127 << "))" |
| << "\n"; |
| |
| uint64_t result = 0; |
| |
| result += a0.a0; |
| result += a0.a1; |
| result += a0.a2; |
| result += a0.a3; |
| result += a0.a4; |
| result += a0.a5; |
| result += a0.a6; |
| result += a0.a7; |
| result += a0.a8; |
| result += a0.a9; |
| result += a0.a10; |
| result += a0.a11; |
| result += a0.a12; |
| result += a0.a13; |
| result += a0.a14; |
| result += a0.a15; |
| result += a0.a16; |
| result += a0.a17; |
| result += a0.a18; |
| result += a0.a19; |
| result += a0.a20; |
| result += a0.a21; |
| result += a0.a22; |
| result += a0.a23; |
| result += a0.a24; |
| result += a0.a25; |
| result += a0.a26; |
| result += a0.a27; |
| result += a0.a28; |
| result += a0.a29; |
| result += a0.a30; |
| result += a0.a31; |
| result += a0.a32; |
| result += a0.a33; |
| result += a0.a34; |
| result += a0.a35; |
| result += a0.a36; |
| result += a0.a37; |
| result += a0.a38; |
| result += a0.a39; |
| result += a0.a40; |
| result += a0.a41; |
| result += a0.a42; |
| result += a0.a43; |
| result += a0.a44; |
| result += a0.a45; |
| result += a0.a46; |
| result += a0.a47; |
| result += a0.a48; |
| result += a0.a49; |
| result += a0.a50; |
| result += a0.a51; |
| result += a0.a52; |
| result += a0.a53; |
| result += a0.a54; |
| result += a0.a55; |
| result += a0.a56; |
| result += a0.a57; |
| result += a0.a58; |
| result += a0.a59; |
| result += a0.a60; |
| result += a0.a61; |
| result += a0.a62; |
| result += a0.a63; |
| result += a0.a64; |
| result += a0.a65; |
| result += a0.a66; |
| result += a0.a67; |
| result += a0.a68; |
| result += a0.a69; |
| result += a0.a70; |
| result += a0.a71; |
| result += a0.a72; |
| result += a0.a73; |
| result += a0.a74; |
| result += a0.a75; |
| result += a0.a76; |
| result += a0.a77; |
| result += a0.a78; |
| result += a0.a79; |
| result += a0.a80; |
| result += a0.a81; |
| result += a0.a82; |
| result += a0.a83; |
| result += a0.a84; |
| result += a0.a85; |
| result += a0.a86; |
| result += a0.a87; |
| result += a0.a88; |
| result += a0.a89; |
| result += a0.a90; |
| result += a0.a91; |
| result += a0.a92; |
| result += a0.a93; |
| result += a0.a94; |
| result += a0.a95; |
| result += a0.a96; |
| result += a0.a97; |
| result += a0.a98; |
| result += a0.a99; |
| result += a0.a100; |
| result += a0.a101; |
| result += a0.a102; |
| result += a0.a103; |
| result += a0.a104; |
| result += a0.a105; |
| result += a0.a106; |
| result += a0.a107; |
| result += a0.a108; |
| result += a0.a109; |
| result += a0.a110; |
| result += a0.a111; |
| result += a0.a112; |
| result += a0.a113; |
| result += a0.a114; |
| result += a0.a115; |
| result += a0.a116; |
| result += a0.a117; |
| result += a0.a118; |
| result += a0.a119; |
| result += a0.a120; |
| result += a0.a121; |
| result += a0.a122; |
| result += a0.a123; |
| result += a0.a124; |
| result += a0.a125; |
| result += a0.a126; |
| result += a0.a127; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Tests the alignment of structs in FPU registers and backfilling. |
| DART_EXPORT float PassFloatStruct16BytesHomogeneousFloatFloatStruct1( |
| float a0, |
| Struct16BytesHomogeneousFloat a1, |
| float a2, |
| Struct16BytesHomogeneousFloat a3, |
| float a4, |
| Struct16BytesHomogeneousFloat a5, |
| float a6, |
| Struct16BytesHomogeneousFloat a7, |
| float a8) { |
| std::cout << "PassFloatStruct16BytesHomogeneousFloatFloatStruct1" |
| << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 |
| << ", " << a1.a3 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1 |
| << ", " << a3.a2 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0 |
| << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6 |
| << ", (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 |
| << "), " << a8 << ")" |
| << "\n"; |
| |
| float result = 0; |
| |
| result += a0; |
| result += a1.a0; |
| result += a1.a1; |
| result += a1.a2; |
| result += a1.a3; |
| result += a2; |
| result += a3.a0; |
| result += a3.a1; |
| result += a3.a2; |
| result += a3.a3; |
| result += a4; |
| result += a5.a0; |
| result += a5.a1; |
| result += a5.a2; |
| result += a5.a3; |
| result += a6; |
| result += a7.a0; |
| result += a7.a1; |
| result += a7.a2; |
| result += a7.a3; |
| result += a8; |
| |
| std::cout << "result = " << result << "\n"; |
| |
| return result; |
| } |
| |
| // Used for testing structs and unions by value. |
| // Tests the alignment of structs in FPU registers and backfilling. |
| DART_EXPORT double PassFloatStruct32BytesHomogeneousDoubleFloatStruct( |
| float a0, |
| Struct32BytesHomogeneousDouble a1, |
| float a2, |
| Struct32BytesHomogeneousDouble a3, |
| float a4, |
| Struct32BytesHomogeneousDouble a5, |
| float a6, |
| Struct32BytesHomogeneousDouble a7, |
| float a8) { |
| std::cout << "PassFloatStruct32BytesHomogeneousDoubleFloatStruct" |
| << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 |
| << ", " << a1.a3 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1 |
| << ", " << a3.a2 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0 |
| << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6 |
| << ", (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << |