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    -mfma
55)
56
57add_entrypoint_object(
58  fma
59  SRCS
60    fma.cpp
61  HDRS
62    fma.h
63  DEPENDS
64    libc.src.__support.FPUtil.fputil
65    libc.src.__support.FPUtil.fma
66  COMPILE_OPTIONS
67    -O3
68    -mfma
69)
70
71add_math_entrypoint_object(ceil)
72add_math_entrypoint_object(ceilf)
73add_math_entrypoint_object(ceill)
74
75add_math_entrypoint_object(copysign)
76add_math_entrypoint_object(copysignf)
77add_math_entrypoint_object(copysignl)
78
79add_math_entrypoint_object(cos)
80add_math_entrypoint_object(cosf)
81
82add_math_entrypoint_object(expf)
83
84add_math_entrypoint_object(exp2f)
85
86add_math_entrypoint_object(expm1f)
87
88add_math_entrypoint_object(fabs)
89add_math_entrypoint_object(fabsf)
90add_math_entrypoint_object(fabsl)
91
92add_math_entrypoint_object(fdim)
93add_math_entrypoint_object(fdimf)
94add_math_entrypoint_object(fdiml)
95
96add_math_entrypoint_object(floor)
97add_math_entrypoint_object(floorf)
98add_math_entrypoint_object(floorl)
99
100add_math_entrypoint_object(fmax)
101add_math_entrypoint_object(fmaxf)
102add_math_entrypoint_object(fmaxl)
103
104add_math_entrypoint_object(fmin)
105add_math_entrypoint_object(fminf)
106add_math_entrypoint_object(fminl)
107
108add_math_entrypoint_object(frexp)
109add_math_entrypoint_object(frexpf)
110add_math_entrypoint_object(frexpl)
111
112add_math_entrypoint_object(hypot)
113add_math_entrypoint_object(hypotf)
114
115add_math_entrypoint_object(ilogb)
116add_math_entrypoint_object(ilogbf)
117add_math_entrypoint_object(ilogbl)
118
119add_math_entrypoint_object(ldexp)
120add_math_entrypoint_object(ldexpf)
121add_math_entrypoint_object(ldexpl)
122
123add_math_entrypoint_object(log10f)
124
125add_math_entrypoint_object(log1pf)
126
127add_math_entrypoint_object(log2f)
128
129add_math_entrypoint_object(logf)
130
131add_math_entrypoint_object(logb)
132add_math_entrypoint_object(logbf)
133add_math_entrypoint_object(logbl)
134
135add_math_entrypoint_object(llrint)
136add_math_entrypoint_object(llrintf)
137add_math_entrypoint_object(llrintl)
138
139add_math_entrypoint_object(llround)
140add_math_entrypoint_object(llroundf)
141add_math_entrypoint_object(llroundl)
142
143add_math_entrypoint_object(lrint)
144add_math_entrypoint_object(lrintf)
145add_math_entrypoint_object(lrintl)
146
147add_math_entrypoint_object(lround)
148add_math_entrypoint_object(lroundf)
149add_math_entrypoint_object(lroundl)
150
151add_math_entrypoint_object(modf)
152add_math_entrypoint_object(modff)
153add_math_entrypoint_object(modfl)
154
155add_math_entrypoint_object(nearbyint)
156add_math_entrypoint_object(nearbyintf)
157add_math_entrypoint_object(nearbyintl)
158
159add_math_entrypoint_object(nextafter)
160add_math_entrypoint_object(nextafterf)
161add_math_entrypoint_object(nextafterl)
162
163add_math_entrypoint_object(remainder)
164add_math_entrypoint_object(remainderf)
165add_math_entrypoint_object(remainderl)
166
167add_math_entrypoint_object(remquo)
168add_math_entrypoint_object(remquof)
169add_math_entrypoint_object(remquol)
170
171add_math_entrypoint_object(rint)
172add_math_entrypoint_object(rintf)
173add_math_entrypoint_object(rintl)
174
175add_math_entrypoint_object(round)
176add_math_entrypoint_object(roundf)
177add_math_entrypoint_object(roundl)
178
179add_math_entrypoint_object(sincosf)
180
181add_math_entrypoint_object(sin)
182add_math_entrypoint_object(sinf)
183
184add_math_entrypoint_object(sqrt)
185add_math_entrypoint_object(sqrtf)
186add_math_entrypoint_object(sqrtl)
187
188add_math_entrypoint_object(tan)
189
190add_math_entrypoint_object(trunc)
191add_math_entrypoint_object(truncf)
192add_math_entrypoint_object(truncl)
193