1040b3049SEd Maste 2cb14a3feSDimitry AndricCRTARCH= ${MACHINE_CPUARCH:C/amd64/x86_64/:C/powerpc/ppc/} 3040b3049SEd Maste 40b57cec5SDimitry AndricCRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins 5040b3049SEd Maste 6040b3049SEd Maste.PATH: ${CRTSRC}/${CRTARCH} 7040b3049SEd Maste.PATH: ${CRTSRC} 8040b3049SEd Maste 9040b3049SEd MasteSRCF+= absvdi2 10040b3049SEd MasteSRCF+= absvsi2 11040b3049SEd MasteSRCF+= absvti2 12040b3049SEd MasteSRCF+= addvdi3 13040b3049SEd MasteSRCF+= addvsi3 14040b3049SEd MasteSRCF+= addvti3 15040b3049SEd MasteSRCF+= apple_versioning 16040b3049SEd MasteSRCF+= ashldi3 17040b3049SEd MasteSRCF+= ashlti3 18040b3049SEd MasteSRCF+= ashrdi3 19040b3049SEd MasteSRCF+= ashrti3 2046c8c554SDimitry AndricSRCF+= bswapdi2 2146c8c554SDimitry AndricSRCF+= bswapsi2 22040b3049SEd MasteSRCF+= clear_cache 23040b3049SEd MasteSRCF+= clzdi2 24040b3049SEd MasteSRCF+= clzsi2 25040b3049SEd MasteSRCF+= clzti2 26040b3049SEd MasteSRCF+= cmpdi2 27040b3049SEd MasteSRCF+= cmpti2 28040b3049SEd MasteSRCF+= ctzdi2 29040b3049SEd MasteSRCF+= ctzsi2 30040b3049SEd MasteSRCF+= ctzti2 31040b3049SEd MasteSRCF+= divdc3 32040b3049SEd MasteSRCF+= divdi3 33040b3049SEd MasteSRCF+= divmoddi4 34040b3049SEd MasteSRCF+= divmodsi4 356e75b2fbSDimitry AndricSRCF+= divmodti4 36040b3049SEd MasteSRCF+= divsc3 3704a91333SJohn BaldwinSRCF+= divsi3 38040b3049SEd MasteSRCF+= divti3 39040b3049SEd MasteSRCF+= enable_execute_stack 40040b3049SEd MasteSRCF+= extendhfsf2 41040b3049SEd MasteSRCF+= ffsdi2 42289fa303SDimitry AndricSRCF+= ffssi2 43040b3049SEd MasteSRCF+= ffsti2 44040b3049SEd MasteSRCF+= fixdfdi 45040b3049SEd MasteSRCF+= fixdfti 46040b3049SEd MasteSRCF+= fixsfdi 47040b3049SEd MasteSRCF+= fixsfti 48040b3049SEd MasteSRCF+= fixunsdfdi 49040b3049SEd MasteSRCF+= fixunsdfsi 50040b3049SEd MasteSRCF+= fixunsdfti 51040b3049SEd MasteSRCF+= fixunssfdi 52040b3049SEd MasteSRCF+= fixunssfsi 53040b3049SEd MasteSRCF+= fixunssfti 54040b3049SEd MasteSRCF+= floattidf 55040b3049SEd MasteSRCF+= floattisf 56040b3049SEd MasteSRCF+= floatunsidf 57040b3049SEd MasteSRCF+= floatunsisf 58040b3049SEd MasteSRCF+= floatuntidf 59040b3049SEd MasteSRCF+= floatuntisf 60040b3049SEd MasteSRCF+= int_util 61040b3049SEd MasteSRCF+= lshrdi3 62040b3049SEd MasteSRCF+= lshrti3 63040b3049SEd MasteSRCF+= moddi3 6404a91333SJohn BaldwinSRCF+= modsi3 65040b3049SEd MasteSRCF+= modti3 66040b3049SEd MasteSRCF+= muldc3 67040b3049SEd MasteSRCF+= muldi3 68040b3049SEd MasteSRCF+= mulodi4 69040b3049SEd MasteSRCF+= mulosi4 70040b3049SEd MasteSRCF+= muloti4 71040b3049SEd MasteSRCF+= mulsc3 72040b3049SEd MasteSRCF+= multi3 73040b3049SEd MasteSRCF+= mulvdi3 74040b3049SEd MasteSRCF+= mulvsi3 75040b3049SEd MasteSRCF+= mulvti3 76040b3049SEd MasteSRCF+= negdf2 77040b3049SEd MasteSRCF+= negdi2 78040b3049SEd MasteSRCF+= negsf2 79040b3049SEd MasteSRCF+= negti2 80040b3049SEd MasteSRCF+= negvdi2 81040b3049SEd MasteSRCF+= negvsi2 82040b3049SEd MasteSRCF+= negvti2 83040b3049SEd MasteSRCF+= paritydi2 84040b3049SEd MasteSRCF+= paritysi2 85040b3049SEd MasteSRCF+= parityti2 86040b3049SEd MasteSRCF+= popcountdi2 87040b3049SEd MasteSRCF+= popcountsi2 88040b3049SEd MasteSRCF+= popcountti2 89040b3049SEd MasteSRCF+= powidf2 90040b3049SEd MasteSRCF+= powisf2 91040b3049SEd MasteSRCF+= subvdi3 92040b3049SEd MasteSRCF+= subvsi3 93040b3049SEd MasteSRCF+= subvti3 94040b3049SEd MasteSRCF+= trampoline_setup 95040b3049SEd MasteSRCF+= truncdfhf2 96040b3049SEd MasteSRCF+= truncsfhf2 97040b3049SEd MasteSRCF+= ucmpdi2 98040b3049SEd MasteSRCF+= ucmpti2 99040b3049SEd MasteSRCF+= udivdi3 100040b3049SEd MasteSRCF+= udivmoddi4 101040b3049SEd MasteSRCF+= udivmodsi4 102040b3049SEd MasteSRCF+= udivmodti4 10304a91333SJohn BaldwinSRCF+= udivsi3 104040b3049SEd MasteSRCF+= udivti3 105040b3049SEd MasteSRCF+= umoddi3 10604a91333SJohn BaldwinSRCF+= umodsi3 107040b3049SEd MasteSRCF+= umodti3 108040b3049SEd Maste 109c90cb435SDimitry Andric# Enable compiler-rt's atomic implementation only for clang, as it uses clang 110c90cb435SDimitry Andric# specific builtins, and gcc packages usually come with their own libatomic. 11118ed63b8SDimitry Andric# Exclude arm which has its own implementations of atomic functions, below. 11218ed63b8SDimitry Andric.if "${COMPILER_TYPE}" == "clang" && ${MACHINE_CPUARCH} != "arm" 113c90cb435SDimitry AndricSRCF+= atomic 114c90cb435SDimitry Andric.endif 115c90cb435SDimitry Andric 1162b12718bSDimitry Andric# Avoid using SSE2 instructions on i386, if unsupported. 1172b12718bSDimitry Andric.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) 118e1ca2b88SDimitry AndricSRCS+= floatdidf.c 119e1ca2b88SDimitry AndricSRCS+= floatdisf.c 120e1ca2b88SDimitry AndricSRCS+= floatundidf.c 121e1ca2b88SDimitry AndricSRCS+= floatundisf.c 122e1ca2b88SDimitry Andric.else 123e1ca2b88SDimitry AndricSRCF+= floatdidf 124e1ca2b88SDimitry AndricSRCF+= floatdisf 125e1ca2b88SDimitry AndricSRCF+= floatundidf 126e1ca2b88SDimitry AndricSRCF+= floatundisf 127cb14a3feSDimitry Andric.endif 128cb14a3feSDimitry Andric 129cb14a3feSDimitry Andric# 130cb14a3feSDimitry Andric# 80-bit long double functions, only used on x86. 131cb14a3feSDimitry Andric# 132cb14a3feSDimitry Andric.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 133cb14a3feSDimitry AndricSRCF+= divxc3 134cb14a3feSDimitry AndricSRCF+= extendxftf2 135cb14a3feSDimitry AndricSRCF+= fixxfdi 136cb14a3feSDimitry AndricSRCF+= fixxfti 137cb14a3feSDimitry AndricSRCF+= fixunsxfdi 138cb14a3feSDimitry AndricSRCF+= fixunsxfsi 139cb14a3feSDimitry AndricSRCF+= fixunsxfti 140cb14a3feSDimitry AndricSRCF+= floattixf 141cb14a3feSDimitry AndricSRCF+= floatuntixf 142cb14a3feSDimitry AndricSRCF+= mulxc3 143cb14a3feSDimitry AndricSRCF+= powixf2 144cb14a3feSDimitry AndricSRCF+= trunctfxf2 145cb14a3feSDimitry Andric 146cb14a3feSDimitry Andric# Avoid using SSE2 instructions on i386, if unsupported. 147cb14a3feSDimitry Andric.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) 148cb14a3feSDimitry AndricSRCS+= floatdixf.c 149cb14a3feSDimitry AndricSRCS+= floatundixf.c 150cb14a3feSDimitry Andric.else 151cb14a3feSDimitry AndricSRCF+= floatdixf 152e1ca2b88SDimitry AndricSRCF+= floatundixf 153e1ca2b88SDimitry Andric.endif 154cb14a3feSDimitry Andric.endif 155e1ca2b88SDimitry Andric 156efe67f33SDimitry Andric# __cpu_model support, only used on aarch64 and x86 157cb14a3feSDimitry Andric.if ${MACHINE_CPUARCH} == "aarch64" 158cb14a3feSDimitry AndricSRCS+= cpu_model/aarch64.c 159cb14a3feSDimitry Andric.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 160cb14a3feSDimitry AndricSRCS+= cpu_model/x86.c 161335bcabeSEd Maste.endif 162335bcabeSEd Maste 163a92579cfSDimitry Andric# The fp_mode implementation for amd64 and i386 is shared, while other 164a92579cfSDimitry Andric# architectures use the regular approach. 165a92579cfSDimitry Andric.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 166a92579cfSDimitry AndricSRCS+= i386/fp_mode.c 167a92579cfSDimitry Andric.else 168a92579cfSDimitry AndricSRCF+= fp_mode 169a92579cfSDimitry Andric.endif 170a92579cfSDimitry Andric 1712ad1d09fSRuslan Bukin# 1722ad1d09fSRuslan Bukin# 128-bit quad precision long double support, 1737804dd52SRuslan Bukin# only used on some architectures. 1742ad1d09fSRuslan Bukin# 1755f757f3fSDimitry Andric.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ 1765f757f3fSDimitry Andric ${MACHINE_CPUARCH} == "riscv" 177040b3049SEd MasteSRCF+= addtf3 178040b3049SEd MasteSRCF+= comparetf2 179cb14a3feSDimitry AndricSRCF+= divtc3 180040b3049SEd MasteSRCF+= divtf3 181040b3049SEd MasteSRCF+= extenddftf2 1826e75b2fbSDimitry AndricSRCF+= extendhftf2 183040b3049SEd MasteSRCF+= extendsftf2 184040b3049SEd MasteSRCF+= fixtfdi 185040b3049SEd MasteSRCF+= fixtfsi 186040b3049SEd MasteSRCF+= fixtfti 187040b3049SEd MasteSRCF+= fixunstfdi 188040b3049SEd MasteSRCF+= fixunstfsi 189040b3049SEd MasteSRCF+= fixunstfti 190cb14a3feSDimitry AndricSRCF+= floatditf 19191baa744SDimitry AndricSRCF+= floatsitf 19291baa744SDimitry AndricSRCF+= floattitf 193cb14a3feSDimitry AndricSRCF+= floatunditf 194040b3049SEd MasteSRCF+= floatunsitf 19591baa744SDimitry AndricSRCF+= floatuntitf 196cb14a3feSDimitry AndricSRCF+= multc3 197040b3049SEd MasteSRCF+= multf3 198cb14a3feSDimitry AndricSRCF+= powitf2 199040b3049SEd MasteSRCF+= subtf3 200040b3049SEd MasteSRCF+= trunctfdf2 2016e75b2fbSDimitry AndricSRCF+= trunctfhf2 202040b3049SEd MasteSRCF+= trunctfsf2 203040b3049SEd Maste.endif 204040b3049SEd Maste 2057804dd52SRuslan Bukin# These are already shipped by libc.a on some architectures. 2061ab9996fSJohn Baldwin.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "riscv" 207040b3049SEd MasteSRCF+= adddf3 208040b3049SEd MasteSRCF+= addsf3 209040b3049SEd MasteSRCF+= divdf3 210040b3049SEd MasteSRCF+= divsf3 211040b3049SEd MasteSRCF+= extendsfdf2 212040b3049SEd MasteSRCF+= fixdfsi 213040b3049SEd MasteSRCF+= fixsfsi 214040b3049SEd MasteSRCF+= floatsidf 215040b3049SEd MasteSRCF+= floatsisf 216040b3049SEd MasteSRCF+= muldf3 217040b3049SEd MasteSRCF+= mulsf3 218040b3049SEd MasteSRCF+= subdf3 219040b3049SEd MasteSRCF+= subsf3 220040b3049SEd MasteSRCF+= truncdfsf2 221040b3049SEd Maste.endif 222040b3049SEd Maste 2231ab9996fSJohn Baldwin.if ${MACHINE_CPUARCH} != "arm" 224040b3049SEd MasteSRCF+= comparedf2 225040b3049SEd MasteSRCF+= comparesf2 226040b3049SEd Maste.endif 227040b3049SEd Maste 2285f757f3fSDimitry Andric# 2295f757f3fSDimitry Andric# bfloat16 support, only used on some architectures. 2305f757f3fSDimitry Andric# 231*2e226748SDimitry Andric.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ 2325f757f3fSDimitry Andric ${MACHINE_CPUARCH} == "arm" || (${MACHINE_CPUARCH} == "i386" && \ 233*2e226748SDimitry Andric !empty(MACHINE_CPU:Msse2)) || ${MACHINE_CPUARCH} == "riscv") && \ 234*2e226748SDimitry Andric !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 130000) 2355f757f3fSDimitry AndricSRCF+= truncdfbf2 2365f757f3fSDimitry AndricSRCF+= truncsfbf2 2375f757f3fSDimitry Andric.endif 2385f757f3fSDimitry Andric 239040b3049SEd Maste# FreeBSD-specific atomic intrinsics. 240b53a8df3SWarner Losh.if ${MACHINE_CPUARCH} == "arm" 241040b3049SEd Maste.PATH: ${SRCTOP}/sys/arm/arm 242040b3049SEd Maste 243040b3049SEd MasteSRCF+= stdatomic 244040b3049SEd MasteCFLAGS+= -DEMIT_SYNC_ATOMICS 245040b3049SEd Maste.endif 246040b3049SEd Maste 247040b3049SEd Maste.for file in ${SRCF} 248ae902a5bSWarner Losh.if ${MACHINE_CPUARCH} == "arm" && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \ 249040b3049SEd Maste && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) 250040b3049SEd MasteSRCS+= ${file}vfp.S 251040b3049SEd Maste. elif exists(${CRTSRC}/${CRTARCH}/${file}.S) 252040b3049SEd MasteSRCS+= ${file}.S 253040b3049SEd Maste. else 254040b3049SEd MasteSRCS+= ${file}.c 255040b3049SEd Maste. endif 256040b3049SEd Maste.endfor 257040b3049SEd Maste 258040b3049SEd Maste.if ${MACHINE_CPUARCH} == "arm" 259040b3049SEd MasteSRCS+= aeabi_div0.c 260040b3049SEd MasteSRCS+= aeabi_idivmod.S 261040b3049SEd MasteSRCS+= aeabi_ldivmod.S 262040b3049SEd MasteSRCS+= aeabi_memcmp.S 263040b3049SEd MasteSRCS+= aeabi_memcpy.S 264040b3049SEd MasteSRCS+= aeabi_memmove.S 265040b3049SEd MasteSRCS+= aeabi_memset.S 266040b3049SEd MasteSRCS+= aeabi_uidivmod.S 267040b3049SEd MasteSRCS+= aeabi_uldivmod.S 268040b3049SEd MasteSRCS+= switch16.S 269040b3049SEd MasteSRCS+= switch32.S 270040b3049SEd MasteSRCS+= switch8.S 271040b3049SEd MasteSRCS+= switchu8.S 272040b3049SEd MasteSRCS+= sync_synchronize.S 273040b3049SEd Maste.endif 274