• 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    ],
43    local_include_dirs: ["math/include"],
44}
45
46cc_defaults {
47    name: "libarm-optimized-routines-defaults",
48    defaults: ["arm-optimized-routines-defaults"],
49    ramdisk_available: true,
50    vendor_ramdisk_available: true,
51    recovery_available: true,
52    native_bridge_supported: true,
53    apex_available: [
54        "//apex_available:platform",
55        "com.android.runtime",
56    ],
57
58    stl: "none",
59    target: {
60        bionic: {
61            static: {
62                system_shared_libs: [],
63            },
64            header_libs: ["libc_headers"],
65        },
66    },
67}
68
69cc_library_static {
70    name: "libarm-optimized-routines-math",
71    defaults: ["libarm-optimized-routines-defaults"],
72    exclude_srcs: [
73        // Provided by:
74        // bionic/libm/upstream-freebsd/lib/msun/src/s_erf.c
75        // bionic/libm/upstream-freebsd/lib/msun/src/s_erff.c
76        "math/erf.c",
77        "math/erf_data.c",
78        "math/erff.c",
79        "math/erff_data.c",
80    ],
81    srcs: [
82        "math/*.c",
83    ],
84
85    // arch-specific settings
86    arch: {
87        arm64: {
88            cflags: [
89                "-DHAVE_FAST_FMA=1",
90            ],
91        },
92    },
93
94    target: {
95        darwin: {
96            enabled: false,
97        },
98        linux_bionic: {
99            enabled: true,
100        },
101    },
102}
103
104cc_library_static {
105    name: "libarm-optimized-routines-string",
106    defaults: ["libarm-optimized-routines-defaults"],
107
108    arch: {
109        arm64: {
110            srcs: [
111                "string/aarch64/memchr-mte.S",
112                "string/aarch64/memchr.S",
113                "string/aarch64/memcmp.S",
114                "string/aarch64/memrchr.S",
115                "string/aarch64/stpcpy-mte.S",
116                "string/aarch64/stpcpy.S",
117                "string/aarch64/strchrnul-mte.S",
118                "string/aarch64/strchrnul.S",
119                "string/aarch64/strchr-mte.S",
120                "string/aarch64/strchr.S",
121                "string/aarch64/strcmp-mte.S",
122                "string/aarch64/strcmp.S",
123                "string/aarch64/strcpy-mte.S",
124                "string/aarch64/strcpy.S",
125                "string/aarch64/strlen-mte.S",
126                "string/aarch64/strlen.S",
127                "string/aarch64/strncmp-mte.S",
128                "string/aarch64/strncmp.S",
129                "string/aarch64/strnlen.S",
130                "string/aarch64/strrchr-mte.S",
131                "string/aarch64/strrchr.S",
132            ],
133            asflags: [
134                "-D__memcmp_aarch64=memcmp",
135                "-D__memrchr_aarch64=memrchr",
136                "-D__strnlen_aarch64=strnlen",
137            ]
138        },
139    },
140}
141
142// adb shell "/data/nativetest64/mathtest/mathtest /data/nativetest64/mathtest/test/testcases/directed/*"
143// adb shell "/data/nativetest/mathtest/mathtest /data/nativetest/mathtest/test/testcases/directed/*"
144cc_test {
145    name: "mathtest",
146    defaults: ["arm-optimized-routines-defaults"],
147    gtest: false,
148    cflags: ["-Wno-missing-braces"],
149    srcs: ["math/test/mathtest.c"],
150    data: ["math/test/testcases/directed/*.tst"],
151    target: {
152        darwin: {
153            enabled: false,
154        },
155        linux_bionic: {
156            enabled: true,
157        },
158    },
159}
160
161cc_test {
162    name: "ulp",
163    defaults: ["arm-optimized-routines-defaults"],
164    gtest: false,
165    srcs: ["math/test/ulp.c"],
166    data: ["math/test/runulp.sh"],
167}
168
169sh_test {
170    name: "arm-optimized-routines-tests",
171    src: "run-arm-optimized-routines-tests-on-android.sh",
172    filename: "run-arm-optimized-routines-tests-on-android.sh",
173    test_suites: ["general-tests"],
174    host_supported: true,
175    device_supported: false,
176    require_root: true,
177    target_required: [
178        "mathtest",
179        "ulp",
180    ],
181}
182