brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 4765ff4 Raw
102 lines · c
1/*2 * Public API.3 *4 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5 * See https://llvm.org/LICENSE.txt for license information.6 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7 */8 9#ifndef _MATHLIB_H10#define _MATHLIB_H11 12float expf (float);13float exp2f (float);14float logf (float);15float log2f (float);16float powf (float, float);17float sinf (float);18float cosf (float);19void sincosf (float, float*, float*);20 21double exp (double);22double exp2 (double);23double log (double);24double log2 (double);25double pow (double, double);26 27/* Scalar functions using the vector algorithm with identical result.  */28float __s_sinf (float);29float __s_cosf (float);30float __s_expf (float);31float __s_expf_1u (float);32float __s_exp2f (float);33float __s_exp2f_1u (float);34float __s_logf (float);35float __s_powf (float, float);36double __s_sin (double);37double __s_cos (double);38double __s_exp (double);39double __s_log (double);40double __s_pow (double, double);41 42#if __aarch64__43#if __GNUC__ >= 544typedef __Float32x4_t __f32x4_t;45typedef __Float64x2_t __f64x2_t;46#elif __clang_major__*100+__clang_minor__ >= 30547typedef __attribute__((__neon_vector_type__(4))) float __f32x4_t;48typedef __attribute__((__neon_vector_type__(2))) double __f64x2_t;49#else50#error Unsupported compiler51#endif52 53/* Vector functions following the base PCS.  */54__f32x4_t __v_sinf (__f32x4_t);55__f32x4_t __v_cosf (__f32x4_t);56__f32x4_t __v_expf (__f32x4_t);57__f32x4_t __v_expf_1u (__f32x4_t);58__f32x4_t __v_exp2f (__f32x4_t);59__f32x4_t __v_exp2f_1u (__f32x4_t);60__f32x4_t __v_logf (__f32x4_t);61__f32x4_t __v_powf (__f32x4_t, __f32x4_t);62__f64x2_t __v_sin (__f64x2_t);63__f64x2_t __v_cos (__f64x2_t);64__f64x2_t __v_exp (__f64x2_t);65__f64x2_t __v_log (__f64x2_t);66__f64x2_t __v_pow (__f64x2_t, __f64x2_t);67 68#if __GNUC__ >= 9 || __clang_major__ >= 869#define __vpcs __attribute__((__aarch64_vector_pcs__))70 71/* Vector functions following the vector PCS.  */72__vpcs __f32x4_t __vn_sinf (__f32x4_t);73__vpcs __f32x4_t __vn_cosf (__f32x4_t);74__vpcs __f32x4_t __vn_expf (__f32x4_t);75__vpcs __f32x4_t __vn_expf_1u (__f32x4_t);76__vpcs __f32x4_t __vn_exp2f (__f32x4_t);77__vpcs __f32x4_t __vn_exp2f_1u (__f32x4_t);78__vpcs __f32x4_t __vn_logf (__f32x4_t);79__vpcs __f32x4_t __vn_powf (__f32x4_t, __f32x4_t);80__vpcs __f64x2_t __vn_sin (__f64x2_t);81__vpcs __f64x2_t __vn_cos (__f64x2_t);82__vpcs __f64x2_t __vn_exp (__f64x2_t);83__vpcs __f64x2_t __vn_log (__f64x2_t);84__vpcs __f64x2_t __vn_pow (__f64x2_t, __f64x2_t);85 86/* Vector functions following the vector PCS using ABI names.  */87__vpcs __f32x4_t _ZGVnN4v_sinf (__f32x4_t);88__vpcs __f32x4_t _ZGVnN4v_cosf (__f32x4_t);89__vpcs __f32x4_t _ZGVnN4v_expf (__f32x4_t);90__vpcs __f32x4_t _ZGVnN4v_exp2f (__f32x4_t);91__vpcs __f32x4_t _ZGVnN4v_logf (__f32x4_t);92__vpcs __f32x4_t _ZGVnN4vv_powf (__f32x4_t, __f32x4_t);93__vpcs __f64x2_t _ZGVnN2v_sin (__f64x2_t);94__vpcs __f64x2_t _ZGVnN2v_cos (__f64x2_t);95__vpcs __f64x2_t _ZGVnN2v_exp (__f64x2_t);96__vpcs __f64x2_t _ZGVnN2v_log (__f64x2_t);97__vpcs __f64x2_t _ZGVnN2vv_pow (__f64x2_t, __f64x2_t);98#endif99#endif100 101#endif102