infix
A JIT-Powered FFI Library for C
|
Tests passing and returning small aggregate types (structs) by value. More...
#include "common/double_tap.h"
#include "types.h"
#include <common/infix_config.h>
#include <infix/infix.h>
#include <math.h>
Macros | |
#define | DBLTAP_IMPLEMENTATION |
Functions | |
double | process_point_by_value (Point p) |
Can be defined by the user to disable all intrinsic-related code. | |
Point | return_point_by_value (void) |
Returns a Point struct by value. | |
int | process_mixed_struct (MixedIntDouble s) |
Processes a mixed-type struct, checking its members. (SysV x64 only) | |
float | sum_vector4 (Vector4 vec) |
Sums the elements of a Vector4 HFA. (AArch64 only) | |
subtest ("Simple struct (Point) passed and returned by value") | |
subtest ("ABI Specific: System V x64 mixed-register struct") | |
subtest ("ABI Specific: AArch64 Homogeneous Floating-point Aggregate (HFA)") | |
subtest ("ABI Specific: 128-bit SIMD Vector") | |
subtest ("ABI Specific: 256-bit AVX Vector") | |
subtest ("ABI Specific: ARM64 Scalable Vector (SVE)") | |
Variables | |
TEST | |
Tests passing and returning small aggregate types (structs) by value.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
This suite verifies the library's ability to handle one of the most complex aspects of any ABI: the rules for passing and returning structs in CPU registers. The behavior is highly platform-dependent.
This file consolidates several previous tests into a single, cohesive suite with the following goals:
struct { double; double; }
to verify basic aggregate handling on all platforms.struct { int; double; }
, which the SysV ABI dictates should be split and passed in one GPR and one XMM register.struct { float v[4]; }
, which is a Homogeneous Floating-point Aggregate (HFA) and should be passed in four consecutive floating-point registers.__m128d
), 256-bit AVX (__m256d
), AArch64 NEON (float64x2_t
), and AArch64 SVE (svfloat64_t
).Platform-specific tests are conditionally compiled using preprocessor guards to ensure they only run on relevant targets.
#define DBLTAP_IMPLEMENTATION |
int process_mixed_struct | ( | MixedIntDouble | s | ) |
Processes a mixed-type struct, checking its members. (SysV x64 only)
double process_point_by_value | ( | Point | p | ) |
Can be defined by the user to disable all intrinsic-related code.
Processes a Point struct passed by value, returning a sum of its members.
subtest | ( | "ABI Specific: 128-bit SIMD Vector" | ) |
subtest | ( | "ABI Specific: 256-bit AVX Vector" | ) |
subtest | ( | "ABI Specific: AArch64 Homogeneous Floating-point Aggregate (HFA)" | ) |
subtest | ( | "ABI Specific: ARM64 Scalable Vector (SVE)" | ) |
subtest | ( | "ABI Specific: System V x64 mixed-register struct" | ) |
subtest | ( | "Simple struct (Point) passed and returned by value" | ) |