1add_subdirectory(generic)
2if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_MACHINE})
3  add_subdirectory(${LIBC_TARGET_MACHINE})
4endif()
5
6function(add_math_entrypoint_object name)
7  # We prefer machine specific implementation if available. Hence we check
8  # that first and retrun early if we are able to add an alias target for the
9  # machine specific implementation.
10  get_fq_target_name("${LIBC_TARGET_MACHINE}.${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_MACHINE}.${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  message(FATAL_ERROR "No machine specific or generic implementation found for ${name}.")
33endfunction()
34
35add_entrypoint_object(
36  fmaf
37  SRCS
38    fmaf.cpp
39  HDRS
40    fmaf.h
41  DEPENDS
42    libc.utils.FPUtil.fputil
43  COMPILE_OPTIONS
44    -O2
45)
46
47add_entrypoint_object(
48  fma
49  SRCS
50    fma.cpp
51  HDRS
52    fma.h
53  DEPENDS
54    libc.utils.FPUtil.fputil
55  COMPILE_OPTIONS
56    -O2
57)
58
59add_math_entrypoint_object(ceil)
60add_math_entrypoint_object(ceilf)
61add_math_entrypoint_object(ceill)
62
63add_math_entrypoint_object(copysign)
64add_math_entrypoint_object(copysignf)
65add_math_entrypoint_object(copysignl)
66
67add_math_entrypoint_object(cosf)
68
69add_math_entrypoint_object(expf)
70
71add_math_entrypoint_object(exp2f)
72
73add_math_entrypoint_object(fabs)
74add_math_entrypoint_object(fabsf)
75add_math_entrypoint_object(fabsl)
76
77add_math_entrypoint_object(fdim)
78add_math_entrypoint_object(fdimf)
79add_math_entrypoint_object(fdiml)
80
81add_math_entrypoint_object(floor)
82add_math_entrypoint_object(floorf)
83add_math_entrypoint_object(floorl)
84
85add_math_entrypoint_object(fmax)
86add_math_entrypoint_object(fmaxf)
87add_math_entrypoint_object(fmaxl)
88
89add_math_entrypoint_object(fmin)
90add_math_entrypoint_object(fminf)
91add_math_entrypoint_object(fminl)
92
93add_math_entrypoint_object(frexp)
94add_math_entrypoint_object(frexpf)
95add_math_entrypoint_object(frexpl)
96
97add_math_entrypoint_object(hypot)
98add_math_entrypoint_object(hypotf)
99
100add_math_entrypoint_object(ilogb)
101add_math_entrypoint_object(ilogbf)
102add_math_entrypoint_object(ilogbl)
103
104add_math_entrypoint_object(ldexp)
105add_math_entrypoint_object(ldexpf)
106add_math_entrypoint_object(ldexpl)
107
108add_math_entrypoint_object(logb)
109add_math_entrypoint_object(logbf)
110add_math_entrypoint_object(logbl)
111
112add_math_entrypoint_object(llrint)
113add_math_entrypoint_object(llrintf)
114add_math_entrypoint_object(llrintl)
115
116add_math_entrypoint_object(llround)
117add_math_entrypoint_object(llroundf)
118add_math_entrypoint_object(llroundl)
119
120add_math_entrypoint_object(lrint)
121add_math_entrypoint_object(lrintf)
122add_math_entrypoint_object(lrintl)
123
124add_math_entrypoint_object(lround)
125add_math_entrypoint_object(lroundf)
126add_math_entrypoint_object(lroundl)
127
128add_math_entrypoint_object(modf)
129add_math_entrypoint_object(modff)
130add_math_entrypoint_object(modfl)
131
132add_math_entrypoint_object(nearbyint)
133add_math_entrypoint_object(nearbyintf)
134add_math_entrypoint_object(nearbyintl)
135
136add_math_entrypoint_object(nextafter)
137add_math_entrypoint_object(nextafterf)
138add_math_entrypoint_object(nextafterl)
139
140add_math_entrypoint_object(remainder)
141add_math_entrypoint_object(remainderf)
142add_math_entrypoint_object(remainderl)
143
144add_math_entrypoint_object(remquo)
145add_math_entrypoint_object(remquof)
146add_math_entrypoint_object(remquol)
147
148add_math_entrypoint_object(rint)
149add_math_entrypoint_object(rintf)
150add_math_entrypoint_object(rintl)
151
152add_math_entrypoint_object(round)
153add_math_entrypoint_object(roundf)
154add_math_entrypoint_object(roundl)
155
156add_math_entrypoint_object(sincosf)
157
158add_math_entrypoint_object(sinf)
159
160add_math_entrypoint_object(sqrt)
161add_math_entrypoint_object(sqrtf)
162add_math_entrypoint_object(sqrtl)
163
164add_math_entrypoint_object(trunc)
165add_math_entrypoint_object(truncf)
166add_math_entrypoint_object(truncl)
167