• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_arm-optimized-routines_license"],
3}
4
5// Added automatically by a large-scale-change
6// See: http://go/android-license-faq
7license {
8    name: "external_arm-optimized-routines_license",
9    visibility: [":__subpackages__"],
10    license_kinds: [
11        "SPDX-license-identifier-MIT",
12    ],
13    license_text: [
14        "LICENSE",
15    ],
16}
17
18cc_defaults {
19    name: "arm-optimized-routines-defaults",
20    host_supported: true,
21    cflags: [
22        "-Werror",
23        "-Wno-unused-parameter",
24        "-O2",
25        "-ffp-contract=fast",
26        "-fno-math-errno",
27
28        // bionic configuration.
29
30        // We're actually implementing bionic here, so we don't want <math.h>
31        // to try to be helpful by renaming long double routines.
32        "-D__BIONIC_LP32_USE_LONG_DOUBLE",
33        "-DFLT_EVAL_METHOD=0",
34
35        // arm-optimized-routines configuration.
36
37        // BSD libm doesn't set errno, and bionic was based on the BSDs.
38        // https://github.com/ARM-software/optimized-routines/issues/16#issuecomment-572009659
39        "-DWANT_ERRNO=0",
40        // TODO: we may want the vector code in future, but it's not ready yet.
41        "-DWANT_VMATH=0",
42        // Disable tests for routines that are not available.
43        "-DWANT_SIMD_TESTS=0",
44        "-DWANT_EXP10_TESTS=0",
45        // Enable MOPS.
46        "-DWANT_MOPS=1",
47    ],
48    local_include_dirs: ["math/include"],
49    arch: {
50        arm64: {
51            oryon: {
52                cflags: [
53                    "-Xclang -target-feature",
54                    "-Xclang +ldp-aligned-only",
55                ],
56            },
57        },
58    },
59}
60
61cc_defaults {
62    name: "libarm-optimized-routines-defaults",
63    defaults: ["arm-optimized-routines-defaults"],
64    ramdisk_available: true,
65    vendor_ramdisk_available: true,
66    recovery_available: true,
67    native_bridge_supported: true,
68    apex_available: [
69        "//apex_available:platform",
70        "com.android.runtime",
71    ],
72
73    stl: "none",
74    target: {
75        bionic: {
76            static: {
77                system_shared_libs: [],
78            },
79            header_libs: ["libc_headers"],
80        },
81    },
82}
83
84cc_library_static {
85    name: "libarm-optimized-routines-math",
86    defaults: ["libarm-optimized-routines-defaults"],
87    srcs: [
88        "math/cosf.c",
89        "math/exp.c",
90        "math/exp2.c",
91        "math/exp2f.c",
92        "math/exp2f_data.c",
93        "math/exp_data.c",
94        "math/expf.c",
95        "math/log.c",
96        "math/log2.c",
97        "math/log2_data.c",
98        "math/log2f.c",
99        "math/log2f_data.c",
100        "math/log_data.c",
101        "math/logf.c",
102        "math/logf_data.c",
103        "math/math_err.c",
104        "math/math_errf.c",
105        "math/pow.c",
106        "math/pow_log_data.c",
107        "math/powf.c",
108        "math/powf_log2_data.c",
109        "math/sincosf.c",
110        "math/sincosf_data.c",
111        "math/sinf.c",
112    ],
113
114    arch: {
115        arm64: {
116            cflags: [
117                "-DHAVE_FAST_FMA=1",
118            ],
119        },
120        riscv64: {
121            cflags: [
122                "-DHAVE_FAST_FMA=1",
123            ],
124        },
125    },
126
127    target: {
128        darwin: {
129            enabled: false,
130        },
131        linux_bionic: {
132            enabled: true,
133        },
134    },
135}
136
137cc_library_static {
138    name: "libarm-optimized-routines-string",
139    defaults: ["libarm-optimized-routines-defaults"],
140
141    arch: {
142        arm64: {
143            srcs: [
144                "string/aarch64/memchr-mte.S",
145                "string/aarch64/memchr.S",
146                "string/aarch64/memcmp.S",
147                "string/aarch64/memcpy-advsimd.S",
148                "string/aarch64/memcpy.S",
149                "string/aarch64/memmove-mops.S",
150                "string/aarch64/memrchr.S",
151                "string/aarch64/memset.S",
152                "string/aarch64/memset-mops.S",
153                "string/aarch64/stpcpy.S",
154                "string/aarch64/strchrnul-mte.S",
155                "string/aarch64/strchrnul.S",
156                "string/aarch64/strchr-mte.S",
157                "string/aarch64/strchr.S",
158                "string/aarch64/strcmp.S",
159                "string/aarch64/strcpy.S",
160                "string/aarch64/strlen-mte.S",
161                "string/aarch64/strlen.S",
162                "string/aarch64/strncmp.S",
163                "string/aarch64/strnlen.S",
164                "string/aarch64/strrchr-mte.S",
165                "string/aarch64/strrchr.S",
166            ],
167        },
168    },
169}
170
171// Memory intrinsics for bare-metal Rust binaries.
172cc_library_static {
173    name: "libarm-optimized-routines-mem",
174    nocrt: true,
175    system_shared_libs: [],
176    stl: "none",
177    sanitize: {
178        hwaddress: false,
179    },
180    arch: {
181        arm64: {
182            srcs: [
183                "string/aarch64/memchr.S",
184                "string/aarch64/memcmp.S",
185                "string/aarch64/memcpy.S",
186                "string/aarch64/memrchr.S",
187                "string/aarch64/memset.S",
188                "string/aarch64/stpcpy.S",
189                "string/aarch64/strchr.S",
190                "string/aarch64/strchrnul.S",
191                "string/aarch64/strcmp.S",
192                "string/aarch64/strcpy.S",
193                "string/aarch64/strlen.S",
194                "string/aarch64/strncmp.S",
195                "string/aarch64/strnlen.S",
196                "string/aarch64/strrchr.S",
197            ],
198            asflags: [
199                "-D__memchr_aarch64=memchr",
200                "-D__memcmp_aarch64=memcmp",
201                "-D__memcpy_aarch64=memcpy",
202                "-D__memmove_aarch64=memmove",
203                "-D__memrchr_aarch64=memrchr",
204                "-D__memset_aarch64=memset",
205                "-D__stpcpy_aarch64=stpcpy",
206                "-D__strchr_aarch64=strchr",
207                "-D__strchrnul_aarch64=strchrnul",
208                "-D__strcmp_aarch64=strcmp",
209                "-D__strcpy_aarch64=strcpy",
210                "-D__strlen_aarch64=strlen",
211                "-D__strncmp_aarch64=strncmp",
212                "-D__strnlen_aarch64=strnlen",
213                "-D__strrchr_aarch64=strrchr",
214            ],
215        },
216    },
217    visibility: ["//bionic/libc"],
218}
219
220// adb shell "/data/nativetest64/mathtest/mathtest /data/nativetest64/mathtest/test/testcases/directed/*"
221// adb shell "/data/nativetest/mathtest/mathtest /data/nativetest/mathtest/test/testcases/directed/*"
222cc_test {
223    name: "mathtest",
224    defaults: ["arm-optimized-routines-defaults"],
225    gtest: false,
226    cflags: ["-Wno-missing-braces"],
227    srcs: ["math/test/mathtest.c"],
228    data: ["math/test/testcases/directed/*.tst"],
229    target: {
230        darwin: {
231            enabled: false,
232        },
233        linux_bionic: {
234            enabled: true,
235        },
236    },
237}
238
239sh_test {
240    name: "arm-optimized-routines-tests",
241    src: "run-arm-optimized-routines-tests-on-android.sh",
242    filename: "run-arm-optimized-routines-tests-on-android.sh",
243    test_suites: ["general-tests"],
244    host_supported: true,
245    device_supported: false,
246    require_root: true,
247    target_required: [
248        "mathtest",
249    ],
250}
251