1 | /* Scalar wrapper for vpcs-enabled Advanced SIMD vector math functions. |
2 | |
3 | Copyright (C) 2023-2024 Free Software Foundation, Inc. |
4 | This file is part of the GNU C Library. |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2.1 of the License, or (at your option) any later version. |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Lesser General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Lesser General Public |
17 | License along with the GNU C Library; if not, see |
18 | <https://www.gnu.org/licenses/>. */ |
19 | |
20 | #define VPCS_VECTOR_WRAPPER(scalar_func, vector_func) \ |
21 | extern __attribute__ ((aarch64_vector_pcs)) \ |
22 | VEC_TYPE vector_func (VEC_TYPE); \ |
23 | FLOAT scalar_func (FLOAT x) \ |
24 | { \ |
25 | int i; \ |
26 | VEC_TYPE mx; \ |
27 | INIT_VEC_LOOP (mx, x, VEC_LEN); \ |
28 | VEC_TYPE mr = vector_func (mx); \ |
29 | TEST_VEC_LOOP (mr, VEC_LEN); \ |
30 | return ((FLOAT) mr[0]); \ |
31 | } |
32 | |
33 | #define VPCS_VECTOR_WRAPPER_ff(scalar_func, vector_func) \ |
34 | extern __attribute__ ((aarch64_vector_pcs)) \ |
35 | VEC_TYPE vector_func (VEC_TYPE, VEC_TYPE); \ |
36 | FLOAT scalar_func (FLOAT x, FLOAT y) \ |
37 | { \ |
38 | int i; \ |
39 | VEC_TYPE mx, my; \ |
40 | INIT_VEC_LOOP (mx, x, VEC_LEN); \ |
41 | INIT_VEC_LOOP (my, y, VEC_LEN); \ |
42 | VEC_TYPE mr = vector_func (mx, my); \ |
43 | TEST_VEC_LOOP (mr, VEC_LEN); \ |
44 | return ((FLOAT) mr[0]); \ |
45 | } |
46 | |