[MIPS GlobalISel] Select MSA vector generic and builtin add
[llvm-complete.git] / utils / gn / secondary / compiler-rt / lib / builtins / BUILD.gn
blobc13aa707f56059c810fd36bddd48e0532de4e678
1 import("//compiler-rt/target.gni")
2 import("//llvm/utils/gn/build/buildflags.gni")
4 declare_args() {
5   # Skip the atomic builtin (should normally be provided by a shared library).
6   compiler_rt_exclude_atomic_builtin = true
8   # Compile builtins for baremetal.
9   compiler_rt_baremetal_build = false
12 static_library("builtins") {
13   output_dir = crt_current_out_dir
14   if (current_os == "mac") {
15     output_name = "clang_rt.osx"
16   } else {
17     output_name = "clang_rt.builtins$crt_current_target_suffix"
18   }
20   complete_static_lib = true
21   configs -= [ "//llvm/utils/gn/build:thin_archive" ]
23   cflags = [
24     "-fPIC",
25     "-fno-builtin",
26   ]
27   if (target_os != "android") {
28     cflags += [ "-fvisibility=hidden" ]
29   }
30   if (!is_debug) {
31     cflags += [ "-fomit-frame-pointer" ]
32   }
33   cflags_c = [ "-std=c11" ]
35   sources = [
36     "absvdi2.c",
37     "absvsi2.c",
38     "absvti2.c",
39     "adddf3.c",
40     "addsf3.c",
41     "addtf3.c",
42     "addvdi3.c",
43     "addvsi3.c",
44     "addvti3.c",
45     "apple_versioning.c",
46     "ashldi3.c",
47     "ashlti3.c",
48     "ashrdi3.c",
49     "ashrti3.c",
50     "bswapdi2.c",
51     "bswapsi2.c",
52     "clzdi2.c",
53     "clzsi2.c",
54     "clzti2.c",
55     "cmpdi2.c",
56     "cmpti2.c",
57     "comparedf2.c",
58     "comparesf2.c",
59     "ctzdi2.c",
60     "ctzsi2.c",
61     "ctzti2.c",
62     "divdc3.c",
63     "divdf3.c",
64     "divdi3.c",
65     "divmoddi4.c",
66     "divmodsi4.c",
67     "divsc3.c",
68     "divsf3.c",
69     "divsi3.c",
70     "divtc3.c",
71     "divtf3.c",
72     "divti3.c",
73     "extendhfsf2.c",
74     "extendsfdf2.c",
75     "ffsdi2.c",
76     "ffssi2.c",
77     "ffsti2.c",
78     "fixdfdi.c",
79     "fixdfsi.c",
80     "fixdfti.c",
81     "fixsfdi.c",
82     "fixsfsi.c",
83     "fixsfti.c",
84     "fixunsdfdi.c",
85     "fixunsdfsi.c",
86     "fixunsdfti.c",
87     "fixunssfdi.c",
88     "fixunssfsi.c",
89     "fixunssfti.c",
90     "floatdidf.c",
91     "floatdisf.c",
92     "floatsidf.c",
93     "floatsisf.c",
94     "floattidf.c",
95     "floattisf.c",
96     "floatundidf.c",
97     "floatundisf.c",
98     "floatunsidf.c",
99     "floatunsisf.c",
100     "floatuntidf.c",
101     "floatuntisf.c",
102     "fp_mode.c",
103     "int_util.c",
104     "lshrdi3.c",
105     "lshrti3.c",
106     "moddi3.c",
107     "modsi3.c",
108     "modti3.c",
109     "muldc3.c",
110     "muldf3.c",
111     "muldi3.c",
112     "mulodi4.c",
113     "mulosi4.c",
114     "muloti4.c",
115     "mulsc3.c",
116     "mulsf3.c",
117     "multf3.c",
118     "multi3.c",
119     "mulvdi3.c",
120     "mulvsi3.c",
121     "mulvti3.c",
122     "negdf2.c",
123     "negdi2.c",
124     "negsf2.c",
125     "negti2.c",
126     "negvdi2.c",
127     "negvsi2.c",
128     "negvti2.c",
129     "os_version_check.c",
130     "paritydi2.c",
131     "paritysi2.c",
132     "parityti2.c",
133     "popcountdi2.c",
134     "popcountsi2.c",
135     "popcountti2.c",
136     "powidf2.c",
137     "powisf2.c",
138     "powitf2.c",
139     "subdf3.c",
140     "subsf3.c",
141     "subtf3.c",
142     "subvdi3.c",
143     "subvsi3.c",
144     "subvti3.c",
145     "trampoline_setup.c",
146     "truncdfhf2.c",
147     "truncdfsf2.c",
148     "truncsfhf2.c",
149     "ucmpdi2.c",
150     "ucmpti2.c",
151     "udivdi3.c",
152     "udivmoddi4.c",
153     "udivmodsi4.c",
154     "udivmodti4.c",
155     "udivsi3.c",
156     "udivti3.c",
157     "umoddi3.c",
158     "umodsi3.c",
159     "umodti3.c",
161     # This depends on unwind.h which is present in Clang headers. We should
162     # reconsider this if we ever decide to support building builtins with
163     # other compilers.
164     "gcc_personality_v0.c",
165   ]
167   if (target_os != "fuchsia") {
168     sources += [
169       "emutls.c",
170       "enable_execute_stack.c",
171       "eprintf.c",
172     ]
173   }
175   if (target_os != "fuchsia" && !compiler_rt_baremetal_build) {
176     sources += [
177       # This comment prevents `gn format` from putting the file on the same line
178       # as `sources +=`, for sync_source_lists_from_cmake.py.
179       "clear_cache.c",
180     ]
181   }
183   if (target_os == "mac") {
184     sources += [
185       "atomic_flag_clear.c",
186       "atomic_flag_clear_explicit.c",
187       "atomic_flag_test_and_set.c",
188       "atomic_flag_test_and_set_explicit.c",
189       "atomic_signal_fence.c",
190       "atomic_thread_fence.c",
191     ]
192   }
194   if ((target_cpu == "x64" && target_os != "win") || target_cpu == "arm64") {
195     # GENERIC_TF_SOURCES
196     sources += [
197       "comparetf2.c",
198       "extenddftf2.c",
199       "extendsftf2.c",
200       "fixtfdi.c",
201       "fixtfsi.c",
202       "fixtfti.c",
203       "fixunstfdi.c",
204       "fixunstfsi.c",
205       "fixunstfti.c",
206       "floatditf.c",
207       "floatsitf.c",
208       "floattitf.c",
209       "floatunditf.c",
210       "floatunsitf.c",
211       "floatuntitf.c",
212       "multc3.c",
213       "trunctfdf2.c",
214       "trunctfsf2.c",
215     ]
216   }
218   if (target_cpu == "x86" || target_cpu == "x64") {
219     sources += [
220       "cpu_model.c",
221       "divxc3.c",
222       "fixunsxfdi.c",
223       "fixunsxfsi.c",
224       "fixunsxfti.c",
225       "fixxfdi.c",
226       "fixxfti.c",
227       "floatdixf.c",
228       "floattixf.c",
229       "floatundixf.c",
230       "floatuntixf.c",
231       "mulxc3.c",
232       "powixf2.c",
233     ]
234   }
235   if (target_cpu == "x86") {
236     sources -= [
237       "ashldi3.c",
238       "ashrdi3.c",
239       "divdi3.c",
240       "floatdidf.c",
241       "floatdisf.c",
242       "floatdixf.c",
243       "floatundidf.c",
244       "floatundisf.c",
245       "floatundixf.c",
246       "lshrdi3.c",
247       "moddi3.c",
248       "muldi3.c",
249       "udivdi3.c",
250       "umoddi3.c",
251     ]
252     sources += [
253       "i386/ashldi3.S",
254       "i386/ashrdi3.S",
255       "i386/divdi3.S",
256       "i386/floatdidf.S",
257       "i386/floatdisf.S",
258       "i386/floatdixf.S",
259       "i386/floatundidf.S",
260       "i386/floatundisf.S",
261       "i386/floatundixf.S",
262       "i386/lshrdi3.S",
263       "i386/moddi3.S",
264       "i386/muldi3.S",
265       "i386/udivdi3.S",
266       "i386/umoddi3.S",
267     ]
268     if (target_os == "win") {
269       sources += [
270         "i386/chkstk.S",
271         "i386/chkstk2.S",
272       ]
273     }
274   } else if (target_cpu == "x64") {
275     sources -= [
276       "floatdidf.c",
277       "floatdisf.c",
278       "floatdixf.c",
279       "floatundidf.c",
280       "floatundisf.c",
281       "floatundixf.c",
282     ]
283     sources += [
284       "x86_64/floatdidf.c",
285       "x86_64/floatdisf.c",
286       "x86_64/floatdixf.c",
287       "x86_64/floatundidf.S",
288       "x86_64/floatundisf.S",
289       "x86_64/floatundixf.S",
290     ]
291     if (target_os == "win") {
292       sources += [
293         "x86_64/chkstk.S",
294         "x86_64/chkstk2.S",
295       ]
296     }
297   }
299   if (target_cpu == "arm") {
300     if (target_os != "mingw") {
301       sources -= [
302         "bswapdi2.c",
303         "bswapsi2.c",
304         "clzdi2.c",
305         "clzsi2.c",
306         "comparesf2.c",
307         "divmodsi4.c",
308         "divsi3.c",
309         "modsi3.c",
310         "udivmodsi4.c",
311         "udivsi3.c",
312         "umodsi3.c",
313       ]
314       sources += [
315         "arm/bswapdi2.S",
316         "arm/bswapsi2.S",
317         "arm/clzdi2.S",
318         "arm/clzsi2.S",
319         "arm/comparesf2.S",
320         "arm/divmodsi4.S",
321         "arm/divsi3.S",
322         "arm/fp_mode.c",
323         "arm/modsi3.S",
324         "arm/sync_fetch_and_add_4.S",
325         "arm/sync_fetch_and_add_8.S",
326         "arm/sync_fetch_and_and_4.S",
327         "arm/sync_fetch_and_and_8.S",
328         "arm/sync_fetch_and_max_4.S",
329         "arm/sync_fetch_and_max_8.S",
330         "arm/sync_fetch_and_min_4.S",
331         "arm/sync_fetch_and_min_8.S",
332         "arm/sync_fetch_and_nand_4.S",
333         "arm/sync_fetch_and_nand_8.S",
334         "arm/sync_fetch_and_or_4.S",
335         "arm/sync_fetch_and_or_8.S",
336         "arm/sync_fetch_and_sub_4.S",
337         "arm/sync_fetch_and_sub_8.S",
338         "arm/sync_fetch_and_umax_4.S",
339         "arm/sync_fetch_and_umax_8.S",
340         "arm/sync_fetch_and_umin_4.S",
341         "arm/sync_fetch_and_umin_8.S",
342         "arm/sync_fetch_and_xor_4.S",
343         "arm/sync_fetch_and_xor_8.S",
344         "arm/udivmodsi4.S",
345         "arm/udivsi3.S",
346         "arm/umodsi3.S",
347       ]
348     } else {
349       sources += [
350         "arm/aeabi_idivmod.S",
351         "arm/aeabi_ldivmod.S",
352         "arm/aeabi_uidivmod.S",
353         "arm/aeabi_uldivmod.S",
354         "arm/chkstk.S",
355         "mingw_fixfloat.c",
356       ]
357     }
358   }
360   if (target_cpu == "arm64") {
361     sources += [
362       # This comment prevents `gn format` from putting the file on the same line
363       # as `sources +=`, for sync_source_lists_from_cmake.py.
364       "aarch64/fp_mode.c",
365     ]
366     if (target_os == "mingw") {
367       sources += [
368         # This comment prevents `gn format` from putting the file on the same
369         # line as `sources +=`, for sync_source_lists_from_cmake.py.
370         "aarch64/chkstk.S",
371       ]
372     }
373   }
375   if (target_cpu == "hexagon") {
376     sources += [
377       "hexagon/common_entry_exit_abi1.S",
378       "hexagon/common_entry_exit_abi2.S",
379       "hexagon/common_entry_exit_legacy.S",
380       "hexagon/dfaddsub.S",
381       "hexagon/dfdiv.S",
382       "hexagon/dffma.S",
383       "hexagon/dfminmax.S",
384       "hexagon/dfmul.S",
385       "hexagon/dfsqrt.S",
386       "hexagon/divdi3.S",
387       "hexagon/divsi3.S",
388       "hexagon/fabs_opt.S",
389       "hexagon/fastmath2_dlib_asm.S",
390       "hexagon/fastmath2_ldlib_asm.S",
391       "hexagon/fastmath_dlib_asm.S",
392       "hexagon/fma_opt.S",
393       "hexagon/fmax_opt.S",
394       "hexagon/fmin_opt.S",
395       "hexagon/memcpy_forward_vp4cp4n2.S",
396       "hexagon/memcpy_likely_aligned.S",
397       "hexagon/moddi3.S",
398       "hexagon/modsi3.S",
399       "hexagon/sfdiv_opt.S",
400       "hexagon/sfsqrt_opt.S",
401       "hexagon/udivdi3.S",
402       "hexagon/udivmoddi4.S",
403       "hexagon/udivmodsi4.S",
404       "hexagon/udivsi3.S",
405       "hexagon/umoddi3.S",
406       "hexagon/umodsi3.S",
407     ]
408   }
410   if (target_cpu == "ppc64") {
411     sources += [
412       "ppc/divtc3.c",
413       "ppc/fixtfdi.c",
414       "ppc/fixunstfdi.c",
415       "ppc/fixunstfti.c",
416       "ppc/floatditf.c",
417       "ppc/floattitf.c",
418       "ppc/floatunditf.c",
419       "ppc/gcc_qadd.c",
420       "ppc/gcc_qdiv.c",
421       "ppc/gcc_qmul.c",
422       "ppc/gcc_qsub.c",
423       "ppc/multc3.c",
424     ]
425   }
427   if (target_cpu == "riscv") {
428     sources += [
429       # This comment prevents `gn format` from putting the file on the same line
430       # as `sources +=`, for sync_source_lists_from_cmake.py.
431       "riscv/mulsi3.S",
432     ]
433   }
435   if (!compiler_rt_exclude_atomic_builtin) {
436     sources += [
437       # This comment prevents `gn format` from putting the file on the same line
438       # as `sources +=`, for sync_source_lists_from_cmake.py.
439       "atomic.c",
440     ]
441   }
444 # Currently unused but necessary to make the sync_source_lists_from_cmake.py
445 # happy.
446 source_set("_unused") {
447   sources = [
448     # Thumb1
449     "arm/addsf3.S",
450     "arm/comparesf2.S",
451     "arm/divsi3.S",
452     "arm/udivsi3.S",
454     # EABI
455     "arm/aeabi_cdcmp.S",
456     "arm/aeabi_cdcmpeq_check_nan.c",
457     "arm/aeabi_cfcmp.S",
458     "arm/aeabi_cfcmpeq_check_nan.c",
459     "arm/aeabi_dcmp.S",
460     "arm/aeabi_div0.c",
461     "arm/aeabi_drsub.c",
462     "arm/aeabi_fcmp.S",
463     "arm/aeabi_frsub.c",
464     "arm/aeabi_idivmod.S",
465     "arm/aeabi_ldivmod.S",
466     "arm/aeabi_memcmp.S",
467     "arm/aeabi_memcpy.S",
468     "arm/aeabi_memmove.S",
469     "arm/aeabi_memset.S",
470     "arm/aeabi_uidivmod.S",
471     "arm/aeabi_uldivmod.S",
473     # Thumb1 JT
474     "arm/switch16.S",
475     "arm/switch32.S",
476     "arm/switch8.S",
477     "arm/switchu8.S",
479     # Thumb1 SjLj
480     "arm/restore_vfp_d8_d15_regs.S",
481     "arm/save_vfp_d8_d15_regs.S",
483     # Thumb1 VFPv2
484     "arm/adddf3vfp.S",
485     "arm/addsf3vfp.S",
486     "arm/divdf3vfp.S",
487     "arm/divsf3vfp.S",
488     "arm/eqdf2vfp.S",
489     "arm/eqsf2vfp.S",
490     "arm/extendsfdf2vfp.S",
491     "arm/fixdfsivfp.S",
492     "arm/fixsfsivfp.S",
493     "arm/fixunsdfsivfp.S",
494     "arm/fixunssfsivfp.S",
495     "arm/floatsidfvfp.S",
496     "arm/floatsisfvfp.S",
497     "arm/floatunssidfvfp.S",
498     "arm/floatunssisfvfp.S",
499     "arm/gedf2vfp.S",
500     "arm/gesf2vfp.S",
501     "arm/gtdf2vfp.S",
502     "arm/gtsf2vfp.S",
503     "arm/ledf2vfp.S",
504     "arm/lesf2vfp.S",
505     "arm/ltdf2vfp.S",
506     "arm/ltsf2vfp.S",
507     "arm/muldf3vfp.S",
508     "arm/mulsf3vfp.S",
509     "arm/nedf2vfp.S",
510     "arm/negdf2vfp.S",
511     "arm/negsf2vfp.S",
512     "arm/nesf2vfp.S",
513     "arm/subdf3vfp.S",
514     "arm/subsf3vfp.S",
515     "arm/truncdfsf2vfp.S",
516     "arm/unorddf2vfp.S",
517     "arm/unordsf2vfp.S",
519     # Thumb1 icache
520     "arm/sync_synchronize.S",
521   ]