1 /* 2 * Function wrappers for mathbench. 3 * 4 * Copyright (c) 2022-2023, Arm Limited. 5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception 6 */ 7 8 static double 9 atan2_wrap (double x) 10 { 11 return atan2 (5.0, x); 12 } 13 14 static float 15 atan2f_wrap (float x) 16 { 17 return atan2f (5.0f, x); 18 } 19 20 static double 21 powi_wrap (double x) 22 { 23 return __builtin_powi (x, (int) round (x)); 24 } 25 26 #if WANT_VMATH 27 #if __aarch64__ 28 29 static double 30 __s_atan2_wrap (double x) 31 { 32 return __s_atan2 (5.0, x); 33 } 34 35 static float 36 __s_atan2f_wrap (float x) 37 { 38 return __s_atan2f (5.0f, x); 39 } 40 41 static v_double 42 __v_atan2_wrap (v_double x) 43 { 44 return __v_atan2 (v_double_dup (5.0), x); 45 } 46 47 static v_float 48 __v_atan2f_wrap (v_float x) 49 { 50 return __v_atan2f (v_float_dup (5.0f), x); 51 } 52 53 #ifdef __vpcs 54 55 __vpcs static v_double 56 __vn_atan2_wrap (v_double x) 57 { 58 return __vn_atan2 (v_double_dup (5.0), x); 59 } 60 61 __vpcs static v_float 62 __vn_atan2f_wrap (v_float x) 63 { 64 return __vn_atan2f (v_float_dup (5.0f), x); 65 } 66 67 __vpcs static v_double 68 _Z_atan2_wrap (v_double x) 69 { 70 return _ZGVnN2vv_atan2 (v_double_dup (5.0), x); 71 } 72 73 __vpcs static v_float 74 _Z_atan2f_wrap (v_float x) 75 { 76 return _ZGVnN4vv_atan2f (v_float_dup (5.0f), x); 77 } 78 79 #endif // __vpcs 80 #endif // __arch64__ 81 #endif // WANT_VMATH 82 83 #if WANT_SVE_MATH 84 85 static sv_float 86 __sv_atan2f_wrap (sv_float x, sv_bool pg) 87 { 88 return __sv_atan2f_x (x, svdup_n_f32 (5.0f), pg); 89 } 90 91 static sv_float 92 _Z_sv_atan2f_wrap (sv_float x, sv_bool pg) 93 { 94 return _ZGVsMxvv_atan2f (x, svdup_n_f32 (5.0f), pg); 95 } 96 97 static sv_double 98 __sv_atan2_wrap (sv_double x, sv_bool pg) 99 { 100 return __sv_atan2_x (x, svdup_n_f64 (5.0), pg); 101 } 102 103 static sv_double 104 _Z_sv_atan2_wrap (sv_double x, sv_bool pg) 105 { 106 return _ZGVsMxvv_atan2 (x, svdup_n_f64 (5.0), pg); 107 } 108 109 static sv_float 110 _Z_sv_powi_wrap (sv_float x, sv_bool pg) 111 { 112 return _ZGVsMxvv_powi (x, svcvt_s32_f32_x (pg, x), pg); 113 } 114 115 static sv_float 116 __sv_powif_wrap (sv_float x, sv_bool pg) 117 { 118 return __sv_powif_x (x, svcvt_s32_f32_x (pg, x), pg); 119 } 120 121 static sv_double 122 _Z_sv_powk_wrap (sv_double x, sv_bool pg) 123 { 124 return _ZGVsMxvv_powk (x, svcvt_s64_f64_x (pg, x), pg); 125 } 126 127 static sv_double 128 __sv_powi_wrap (sv_double x, sv_bool pg) 129 { 130 return __sv_powi_x (x, svcvt_s64_f64_x (pg, x), pg); 131 } 132 133 #endif // WANT_SVE_MATH 134