xref: /freebsd/contrib/arm-optimized-routines/math/include/mathlib.h (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1 /*
2  * Public API.
3  *
4  * Copyright (c) 2015-2023, Arm Limited.
5  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6  */
7 
8 #ifndef _MATHLIB_H
9 #define _MATHLIB_H
10 
11 float expf (float);
12 float exp2f (float);
13 float logf (float);
14 float log2f (float);
15 float powf (float, float);
16 float sinf (float);
17 float cosf (float);
18 void sincosf (float, float*, float*);
19 
20 double exp (double);
21 double exp10 (double);
22 double exp2 (double);
23 double log (double);
24 double log2 (double);
25 double pow (double, double);
26 
27 #if __aarch64__
28 # if __GNUC__ >= 5
29 typedef __Float32x4_t __f32x4_t;
30 typedef __Float64x2_t __f64x2_t;
31 # elif __clang_major__*100+__clang_minor__ >= 305
32 typedef __attribute__((__neon_vector_type__(4))) float __f32x4_t;
33 typedef __attribute__((__neon_vector_type__(2))) double __f64x2_t;
34 # else
35 #  error Unsupported compiler
36 # endif
37 
38 # if __GNUC__ >= 9 || __clang_major__ >= 8
39 #  undef __vpcs
40 #  define __vpcs __attribute__((__aarch64_vector_pcs__))
41 
42 /* Vector functions following the vector PCS using ABI names.  */
43 __vpcs __f32x4_t _ZGVnN4v_sinf (__f32x4_t);
44 __vpcs __f32x4_t _ZGVnN4v_cosf (__f32x4_t);
45 __vpcs __f32x4_t _ZGVnN4v_expf_1u (__f32x4_t);
46 __vpcs __f32x4_t _ZGVnN4v_expf (__f32x4_t);
47 __vpcs __f32x4_t _ZGVnN4v_exp2f_1u (__f32x4_t);
48 __vpcs __f32x4_t _ZGVnN4v_exp2f (__f32x4_t);
49 __vpcs __f32x4_t _ZGVnN4v_logf (__f32x4_t);
50 __vpcs __f32x4_t _ZGVnN4vv_powf (__f32x4_t, __f32x4_t);
51 __vpcs __f64x2_t _ZGVnN2v_sin (__f64x2_t);
52 __vpcs __f64x2_t _ZGVnN2v_cos (__f64x2_t);
53 __vpcs __f64x2_t _ZGVnN2v_exp (__f64x2_t);
54 __vpcs __f64x2_t _ZGVnN2v_log (__f64x2_t);
55 __vpcs __f64x2_t _ZGVnN2vv_pow (__f64x2_t, __f64x2_t);
56 # endif
57 #endif
58 
59 #endif
60