/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/libffi/testsuite/libffi.vector/vector_float32x2.c
53 строки
1 KB
Node.js GitHub Bot
deps: update libffi to 3.8.0
11 авг 2026, 03:35
Не верифицирован
11 авг 2026, 03:35
01f2018
Код
Авторство
О чём код?
/* Area: ffi_call Purpose: Pass and return an 8-byte float32x2 vector (single D/SSE reg). Limitations: none. PR: none. Originator: libffi vector support. */ /* { dg-do run } */ #include "vector.h" typedef float f32x2 __attribute__((vector_size (8))); static f32x2 add_f32x2 (f32x2 a, f32x2 b) { return a + b; } int main (void) { ffi_cif cif; ffi_type vec_type; ffi_type *vec_elems[3]; ffi_type *args[2]; void *values[2]; f32x2 a = { 3, 4 }; f32x2 b = { 5, 6 }; f32x2 r, ref; int i; make_vector_type (&vec_type, vec_elems, &ffi_type_float, 2); args[0] = &vec_type; args[1] = &vec_type; values[0] = &a; values[1] = &b; CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 2, &vec_type, args) == FFI_OK); CHECK (vec_type.size == 8); CHECK (vec_type.alignment == 8); ffi_call (&cif, FFI_FN (add_f32x2), &r, values); ref = add_f32x2 (a, b); for (i = 0; i < 2; i++) { printf ("r[%d] = %g (want %g)\n", i, (double) r[i], (double) ref[i]); CHECK (r[i] == ref[i]); } exit (0); }