1 2include_directories(libm_sse2) 3 4list(APPEND LIBCNTPR_MATH_SOURCE 5 math/_invoke_matherr.c 6 math/abs.c 7 math/div.c 8 math/labs.c 9 math/sincos.c 10) 11 12if(ARCH STREQUAL "i386") 13 list(APPEND LIBCNTPR_MATH_SOURCE 14 math/fabs.c 15 math/fabsf.c 16 math/i386/ci.c 17 math/i386/cicos.c 18 math/i386/cilog.c 19 math/i386/cipow.c 20 math/i386/cisin.c 21 math/i386/cisqrt.c 22 math/i386/ldexp.c 23 ) 24 list(APPEND LIBCNTPR_MATH_ASM_SOURCE 25 math/i386/alldiv_asm.s 26 math/i386/alldvrm_asm.s 27 math/i386/allmul_asm.s 28 math/i386/allrem_asm.s 29 math/i386/allshl_asm.s 30 math/i386/allshr_asm.s 31 math/i386/atan_asm.s 32 math/i386/atan2_asm.s 33 math/i386/aulldiv_asm.s 34 math/i386/aulldvrm_asm.s 35 math/i386/aullrem_asm.s 36 math/i386/aullshr_asm.s 37 math/i386/ceil_asm.s 38 math/i386/cos_asm.s 39 # math/i386/fabs_asm.s # FIXME 40 math/i386/floor_asm.s 41 math/i386/ftol_asm.s 42 math/i386/ftol2_asm.s 43 math/i386/log_asm.s 44 math/i386/log10_asm.s 45 math/i386/pow_asm.s 46 math/i386/sin_asm.s 47 math/i386/sqrt_asm.s 48 math/i386/tan_asm.s 49 ) 50 list(APPEND CRT_MATH_ASM_SOURCE 51 math/i386/ceilf.S 52 math/i386/floorf.S 53 math/i386/exp_asm.s 54 math/i386/fmod_asm.s 55 math/i386/fmodf_asm.s 56 ) 57elseif(ARCH STREQUAL "amd64") 58 list(APPEND LIBCNTPR_MATH_SOURCE 59 math/amd64/_set_statfp.c 60 # math/libm_sse2/_chgsign.c 61 # math/libm_sse2/_chgsignf.c 62 # math/libm_sse2/_copysign.c 63 # math/libm_sse2/_copysignf.c 64 # math/libm_sse2/_finite.c 65 # math/libm_sse2/_finitef.c 66 math/libm_sse2/_handle_error.c 67 math/libm_sse2/acos.c 68 math/libm_sse2/acosf.c 69 math/libm_sse2/asin.c 70 math/libm_sse2/asinf.c 71 math/libm_sse2/atan.c 72 math/libm_sse2/atan2.c 73 math/libm_sse2/atan2f.c 74 math/libm_sse2/atanf.c 75 # math/libm_sse2/cabs.c 76 # math/libm_sse2/cabsf.c 77 math/libm_sse2/ceil.c 78 math/libm_sse2/ceilf.c 79 math/libm_sse2/cosh.c 80 math/libm_sse2/coshf.c 81 math/libm_sse2/exp_special.c 82 math/libm_sse2/exp2.c 83 math/libm_sse2/floor.c 84 math/libm_sse2/floorf.c 85 math/libm_sse2/fma3_available.c 86 math/libm_sse2/hypot.c 87 math/libm_sse2/hypotf.c 88 math/libm_sse2/L2_by_pi_bits.c 89 math/libm_sse2/ldexp.c 90 # math/libm_sse2/ldexpf.c 91 math/libm_sse2/log_128_lead_tail_table.c 92 math/libm_sse2/log_256_lead_tail_table.c 93 math/libm_sse2/log_F_inv_dword_table.c 94 math/libm_sse2/log_F_inv_qword_table.c 95 math/libm_sse2/log_special.c 96 math/libm_sse2/log10_128_lead_tail_table.c 97 math/libm_sse2/log10_256_lead_tail_table.c 98 math/libm_sse2/logb.c 99 math/libm_sse2/logbf.c 100 math/libm_sse2/Lsincos_array.c 101 math/libm_sse2/Lsincosf_array.c 102 math/libm_sse2/modf.c 103 math/libm_sse2/modff.c 104 math/libm_sse2/pow_special.c 105 # math/libm_sse2/remainder.c 106 math/libm_sse2/remainder_piby2.c 107 # math/libm_sse2/remainder_piby2f.c 108 # math/libm_sse2/remainderf.c 109 math/libm_sse2/sincos_special.c 110 math/libm_sse2/sinh.c 111 math/libm_sse2/sinhf.c 112 math/libm_sse2/sqrt.c 113 math/libm_sse2/sqrtf.c 114 math/libm_sse2/tan.c 115 math/libm_sse2/tanf.c 116 math/libm_sse2/tanh.c 117 math/libm_sse2/tanhf.c 118 math/libm_sse2/two_to_jby64_head_tail_table.c 119 math/libm_sse2/two_to_jby64_table.c 120 ) 121 list(APPEND LIBCNTPR_MATH_ASM_SOURCE 122 math/libm_sse2/fm.inc 123 math/libm_sse2/cos.asm 124 math/libm_sse2/cosf.asm 125 math/libm_sse2/exp.asm 126 math/libm_sse2/expf.asm 127 math/amd64/fabs.S 128 math/amd64/fabsf.S 129 math/libm_sse2/fmod.asm 130 math/libm_sse2/fmodf.asm 131 math/libm_sse2/log.asm 132 math/libm_sse2/log10.asm 133 math/libm_sse2/pow.asm 134 math/libm_sse2/remainder_piby2_forAsm.asm 135 math/libm_sse2/remainder_piby2_forFMA3.asm 136 math/libm_sse2/remainder_piby2f_forAsm.asm 137 math/libm_sse2/remainder_piby2f_forC.asm 138 math/libm_sse2/sin.asm 139 math/libm_sse2/sinf.asm 140 ) 141elseif(ARCH STREQUAL "arm") 142 list(APPEND LIBCNTPR_MATH_SOURCE 143 math/cos.c 144 math/ceilf.c 145 math/fabs.c 146 math/fabsf.c 147 math/floorf.c 148 math/sin.c 149 math/sqrt.c 150 math/sqrtf.c 151 math/arm/__rt_sdiv.c 152 math/arm/__rt_sdiv64_worker.c 153 math/arm/__rt_udiv.c 154 math/arm/__rt_udiv64_worker.c 155 math/arm/__rt_div_worker.h 156 math/arm/__dtoi64.c 157 math/arm/__dtou64.c 158 math/arm/__stoi64.c 159 math/arm/__stou64.c 160 math/arm/__fto64.h 161 math/arm/__i64tod.c 162 math/arm/__u64tod.c 163 math/arm/__i64tos.c 164 math/arm/__u64tos.c 165 math/arm/__64tof.h 166 ) 167 list(APPEND CRT_MATH_SOURCE 168 math/_hypotf.c 169 math/acosf.c 170 math/asinf.c 171 math/atan2f.c 172 math/atanf.c 173 math/coshf.c 174 math/expf.c 175 math/fabsf.c 176 math/fmodf.c 177 math/modff.c 178 math/sinf.c 179 math/sinhf.c 180 math/tanf.c 181 math/tanhf.c 182 ) 183 list(APPEND LIBCNTPR_MATH_ASM_SOURCE 184 math/arm/atan.s 185 math/arm/atan2.s 186 math/arm/ceil.s 187 math/arm/exp.s 188 math/arm/fmod.s 189 math/arm/floor.s 190 math/arm/ldexp.s 191 math/arm/log.s 192 math/arm/log10.s 193 math/arm/pow.s 194 math/arm/tan.s 195 math/arm/__rt_sdiv64.s 196 math/arm/__rt_srsh.s 197 math/arm/__rt_udiv64.s 198 ) 199 list(APPEND CRT_MATH_ASM_SOURCE 200 math/arm/_logb.s 201 ) 202endif() 203 204if(NOT ARCH STREQUAL "i386") 205 list(APPEND CRT_MATH_SOURCE 206 math/_chgsignf.c 207 math/_copysignf.c 208 math/log10f.c 209 math/stubs.c 210 ) 211endif() 212 213if(NOT ARCH STREQUAL "amd64") 214 list(APPEND CRT_MATH_SOURCE 215 math/acos.c 216 math/asin.c 217 math/cosh.c 218 math/cosf.c 219 math/hypot.c 220 math/modf.c 221 math/s_modf.c 222 math/sinh.c 223 math/tanh.c 224 ) 225endif() 226 227list(APPEND CRT_MATH_SOURCE 228 ${LIBCNTPR_MATH_SOURCE} 229 math/adjust.c 230 math/cabs.c 231 math/fdivbug.c 232 math/frexp.c 233 math/huge_val.c 234 math/ieee754/j0_y0.c 235 math/ieee754/j1_y1.c 236 math/ieee754/jn_yn.c 237 math/j0_y0.c 238 math/j1_y1.c 239 math/jn_yn.c 240 math/ldiv.c 241 math/logf.c 242 math/powf.c 243 math/rand.c 244) 245 246list(APPEND CRT_MATH_ASM_SOURCE 247 ${LIBCNTPR_MATH_ASM_SOURCE} 248) 249 250list(APPEND LIBCNTPR_MATH_SOURCE 251 math/rand_nt.c 252) 253 254if(ARCH STREQUAL "i386") 255 list(APPEND ATAN2_ASM_SOURCE math/i386/atan2_asm.s) 256elseif(ARCH STREQUAL "amd64") 257 list(APPEND ATAN2_SOURCE math/_invoke_matherr.c math/amd64/_set_statfp.c math/libm_sse2/_handle_error.c math/libm_sse2/atan2.c) 258elseif(ARCH STREQUAL "arm") 259 list(APPEND ATAN2_ASM_SOURCE math/arm/atan2.s) 260elseif(ARCH STREQUAL "arm64") 261 list(APPEND ATAN2_ASM_SOURCE math/arm64/atan2.s) 262endif() 263 264add_asm_files(atan2_asm ${ATAN2_ASM_SOURCE}) 265add_library(atan2 ${ATAN2_SOURCE} ${atan2_asm}) 266set_target_properties(atan2 PROPERTIES LINKER_LANGUAGE "C") 267add_dependencies(atan2 asm) 268