1add_subdirectory(generic)
2if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
3  add_subdirectory(${LIBC_TARGET_ARCHITECTURE})
4endif()
5
6function(add_math_entrypoint_object name)
7  # We prefer machine specific implementation if available. Hence we check
8  # that first and return early if we are able to add an alias target for the
9  # machine specific implementation.
10  get_fq_target_name("${LIBC_TARGET_ARCHITECTURE}.${name}" fq_machine_specific_target_name)
11  if(TARGET ${fq_machine_specific_target_name})
12    add_entrypoint_object(
13      ${name}
14      ALIAS
15      DEPENDS
16        .${LIBC_TARGET_ARCHITECTURE}.${name}
17    )
18    return()
19  endif()
20
21  get_fq_target_name("generic.${name}" fq_generic_target_name)
22  if(TARGET ${fq_generic_target_name})
23    add_entrypoint_object(
24      ${name}
25      ALIAS
26      DEPENDS
27        .generic.${name}
28    )
29    return()
30  endif()
31
32  # Add a dummy entrypoint object for missing implementations. They will be skipped
33  # anyway as there will be no entry for them in the target entrypoints list.
34  add_entrypoint_object(
35    ${name}
36    SRCS
37      dummy_srcs
38    HDRS
39      dummy_hdrs
40  )
41endfunction()
42
43add_entrypoint_object(
44  fmaf
45  SRCS
46    fmaf.cpp
47  HDRS
48    fmaf.h
49  DEPENDS
50    libc.src.__support.FPUtil.fputil
51    libc.src.__support.FPUtil.fma
52  COMPILE_OPTIONS
53    -O3
54)
55
56add_entrypoint_object(
57  fma
58  SRCS
59    fma.cpp
60  HDRS
61    fma.h
62  DEPENDS
63    libc.src.__support.FPUtil.fputil
64    libc.src.__support.FPUtil.fma
65  COMPILE_OPTIONS
66    -O3
67)
68
69add_math_entrypoint_object(ceil)
70add_math_entrypoint_object(ceilf)
71add_math_entrypoint_object(ceill)
72
73add_math_entrypoint_object(copysign)
74add_math_entrypoint_object(copysignf)
75add_math_entrypoint_object(copysignl)
76
77add_math_entrypoint_object(cos)
78add_math_entrypoint_object(cosf)
79
80add_math_entrypoint_object(expf)
81
82add_math_entrypoint_object(exp2f)
83
84add_math_entrypoint_object(expm1f)
85
86add_math_entrypoint_object(fabs)
87add_math_entrypoint_object(fabsf)
88add_math_entrypoint_object(fabsl)
89
90add_math_entrypoint_object(fdim)
91add_math_entrypoint_object(fdimf)
92add_math_entrypoint_object(fdiml)
93
94add_math_entrypoint_object(floor)
95add_math_entrypoint_object(floorf)
96add_math_entrypoint_object(floorl)
97
98add_math_entrypoint_object(fmax)
99add_math_entrypoint_object(fmaxf)
100add_math_entrypoint_object(fmaxl)
101
102add_math_entrypoint_object(fmin)
103add_math_entrypoint_object(fminf)
104add_math_entrypoint_object(fminl)
105
106add_math_entrypoint_object(fmod)
107add_math_entrypoint_object(fmodf)
108
109add_math_entrypoint_object(frexp)
110add_math_entrypoint_object(frexpf)
111add_math_entrypoint_object(frexpl)
112
113add_math_entrypoint_object(hypot)
114add_math_entrypoint_object(hypotf)
115
116add_math_entrypoint_object(ilogb)
117add_math_entrypoint_object(ilogbf)
118add_math_entrypoint_object(ilogbl)
119
120add_math_entrypoint_object(ldexp)
121add_math_entrypoint_object(ldexpf)
122add_math_entrypoint_object(ldexpl)
123
124add_math_entrypoint_object(log10f)
125
126add_math_entrypoint_object(log1pf)
127
128add_math_entrypoint_object(log2f)
129
130add_math_entrypoint_object(logf)
131
132add_math_entrypoint_object(logb)
133add_math_entrypoint_object(logbf)
134add_math_entrypoint_object(logbl)
135
136add_math_entrypoint_object(llrint)
137add_math_entrypoint_object(llrintf)
138add_math_entrypoint_object(llrintl)
139
140add_math_entrypoint_object(llround)
141add_math_entrypoint_object(llroundf)
142add_math_entrypoint_object(llroundl)
143
144add_math_entrypoint_object(lrint)
145add_math_entrypoint_object(lrintf)
146add_math_entrypoint_object(lrintl)
147
148add_math_entrypoint_object(lround)
149add_math_entrypoint_object(lroundf)
150add_math_entrypoint_object(lroundl)
151
152add_math_entrypoint_object(modf)
153add_math_entrypoint_object(modff)
154add_math_entrypoint_object(modfl)
155
156add_math_entrypoint_object(nearbyint)
157add_math_entrypoint_object(nearbyintf)
158add_math_entrypoint_object(nearbyintl)
159
160add_math_entrypoint_object(nextafter)
161add_math_entrypoint_object(nextafterf)
162add_math_entrypoint_object(nextafterl)
163
164add_math_entrypoint_object(remainder)
165add_math_entrypoint_object(remainderf)
166add_math_entrypoint_object(remainderl)
167
168add_math_entrypoint_object(remquo)
169add_math_entrypoint_object(remquof)
170add_math_entrypoint_object(remquol)
171
172add_math_entrypoint_object(rint)
173add_math_entrypoint_object(rintf)
174add_math_entrypoint_object(rintl)
175
176add_math_entrypoint_object(round)
177add_math_entrypoint_object(roundf)
178add_math_entrypoint_object(roundl)
179
180add_math_entrypoint_object(sincosf)
181
182add_math_entrypoint_object(sin)
183add_math_entrypoint_object(sinf)
184
185add_math_entrypoint_object(sqrt)
186add_math_entrypoint_object(sqrtf)
187add_math_entrypoint_object(sqrtl)
188
189add_math_entrypoint_object(tan)
190
191add_math_entrypoint_object(trunc)
192add_math_entrypoint_object(truncf)
193add_math_entrypoint_object(truncl)
194