Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 1 | cc_defaults { |
| 2 | name: "arm-optimized-routines-defaults", |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 3 | host_supported: true, |
| 4 | cflags: [ |
| 5 | "-Werror", |
Elliott Hughes | 7504fa9 | 2019-10-16 11:00:15 -0700 | [diff] [blame] | 6 | "-Wno-unused-parameter", |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 7 | "-O2", |
Elliott Hughes | ef3eb23 | 2020-01-10 15:06:56 -0800 | [diff] [blame] | 8 | "-ffp-contract=fast", |
| 9 | "-fno-math-errno", |
| 10 | |
| 11 | // bionic configuration. |
| 12 | |
Elliott Hughes | 055b2f3 | 2019-09-17 13:05:56 -0700 | [diff] [blame] | 13 | // We're actually implementing bionic here, so we don't want <math.h> |
| 14 | // to try to be helpful by renaming long double routines. |
| 15 | "-D__BIONIC_LP32_USE_LONG_DOUBLE", |
Adhemerval Zanella | 9e6e832 | 2018-07-26 11:43:46 -0300 | [diff] [blame] | 16 | "-DFLT_EVAL_METHOD=0", |
Elliott Hughes | ef3eb23 | 2020-01-10 15:06:56 -0800 | [diff] [blame] | 17 | |
| 18 | // arm-optimized-routines configuration. |
| 19 | |
| 20 | // BSD libm doesn't set errno, and bionic was based on the BSDs. |
| 21 | // https://github.com/ARM-software/optimized-routines/issues/16#issuecomment-572009659 |
| 22 | "-DWANT_ERRNO=0", |
Elliott Hughes | 9ba6fed | 2020-01-13 09:07:28 -0800 | [diff] [blame] | 23 | // TODO: we may want the vector code in future, but it's not ready yet. |
Elliott Hughes | ef3eb23 | 2020-01-10 15:06:56 -0800 | [diff] [blame] | 24 | "-DWANT_VMATH=0", |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 25 | ], |
Elliott Hughes | 3f88536 | 2019-10-15 09:04:39 -0700 | [diff] [blame] | 26 | local_include_dirs: ["math/include"], |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 27 | } |
| 28 | |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 29 | cc_defaults { |
| 30 | name: "libarm-optimized-routines-defaults", |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 31 | defaults: ["arm-optimized-routines-defaults"], |
Yifan Hong | 212cd84 | 2020-01-21 18:16:50 -0800 | [diff] [blame] | 32 | ramdisk_available: true, |
Yifan Hong | c13a69b | 2020-10-21 18:39:44 -0700 | [diff] [blame] | 33 | vendor_ramdisk_available: true, |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 34 | recovery_available: true, |
| 35 | native_bridge_supported: true, |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 36 | apex_available: [ |
| 37 | "//apex_available:platform", |
| 38 | "com.android.runtime", |
| 39 | ], |
| 40 | |
| 41 | stl: "none", |
| 42 | static: { |
| 43 | system_shared_libs: [], |
| 44 | }, |
Martin Stjernholm | cec4de0 | 2020-04-08 01:02:20 +0100 | [diff] [blame] | 45 | header_libs: ["libc_headers"], |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | cc_library { |
| 49 | name: "libarm-optimized-routines-math", |
| 50 | defaults: ["libarm-optimized-routines-defaults"], |
Haibo Huang | 59371d5 | 2020-11-30 18:13:41 -0800 | [diff] [blame] | 51 | exclude_srcs: [ |
| 52 | // Provided by: |
| 53 | // bionic/libm/upstream-freebsd/lib/msun/src/s_erf.c |
| 54 | // bionic/libm/upstream-freebsd/lib/msun/src/s_erff.c |
| 55 | "math/erf.c", |
| 56 | "math/erf_data.c", |
| 57 | "math/erff.c", |
| 58 | "math/erff_data.c", |
| 59 | ], |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 60 | srcs: [ |
Haibo Huang | cd7d536 | 2019-07-31 18:22:02 -0700 | [diff] [blame] | 61 | "math/*.c", |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 62 | ], |
Adhemerval Zanella | 8e8d1b7 | 2018-08-06 13:22:58 -0300 | [diff] [blame] | 63 | |
| 64 | // arch-specific settings |
| 65 | arch: { |
| 66 | arm64: { |
| 67 | cflags: [ |
| 68 | "-DHAVE_FAST_FMA=1", |
| 69 | ], |
| 70 | }, |
| 71 | }, |
| 72 | |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 73 | target: { |
Christopher Ferris | 8785a76 | 2018-07-27 13:59:37 -0700 | [diff] [blame] | 74 | darwin: { |
| 75 | enabled: false, |
| 76 | }, |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 77 | linux_bionic: { |
| 78 | enabled: true, |
| 79 | }, |
| 80 | }, |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | cc_library { |
| 84 | name: "libarm-optimized-routines-string", |
| 85 | defaults: ["libarm-optimized-routines-defaults"], |
| 86 | |
| 87 | arch: { |
| 88 | arm64: { |
| 89 | srcs: [ |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 90 | "string/aarch64/memchr-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 91 | "string/aarch64/memchr.S", |
| 92 | "string/aarch64/memcmp.S", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 93 | "string/aarch64/memrchr.S", |
| 94 | "string/aarch64/stpcpy-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 95 | "string/aarch64/stpcpy.S", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 96 | "string/aarch64/strchrnul-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 97 | "string/aarch64/strchrnul.S", |
| 98 | "string/aarch64/strchr-mte.S", |
| 99 | "string/aarch64/strchr.S", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 100 | "string/aarch64/strcmp-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 101 | "string/aarch64/strcmp.S", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 102 | "string/aarch64/strcpy-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 103 | "string/aarch64/strcpy.S", |
| 104 | "string/aarch64/strlen-mte.S", |
| 105 | "string/aarch64/strlen.S", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 106 | "string/aarch64/strncmp-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 107 | "string/aarch64/strncmp.S", |
| 108 | "string/aarch64/strnlen.S", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 109 | "string/aarch64/strrchr-mte.S", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 110 | "string/aarch64/strrchr.S", |
| 111 | ], |
| 112 | asflags: [ |
| 113 | "-D__memcmp_aarch64=memcmp", |
Peter Collingbourne | 5bde7af | 2020-06-03 16:56:02 -0700 | [diff] [blame] | 114 | "-D__memrchr_aarch64=memrchr", |
| 115 | "-D__strnlen_aarch64=strnlen", |
Peter Collingbourne | a1546db | 2020-02-21 12:19:26 -0800 | [diff] [blame] | 116 | ] |
| 117 | }, |
Dan Willemsen | 35edf45 | 2018-12-03 13:56:24 -0800 | [diff] [blame] | 118 | }, |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 119 | } |
| 120 | |
Elliott Hughes | e9c7105 | 2018-08-01 13:26:04 -0700 | [diff] [blame] | 121 | // adb shell "/data/nativetest64/mathtest/mathtest /data/nativetest64/mathtest/test/testcases/directed/*" |
| 122 | // adb shell "/data/nativetest/mathtest/mathtest /data/nativetest/mathtest/test/testcases/directed/*" |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 123 | cc_test { |
| 124 | name: "mathtest", |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 125 | defaults: ["arm-optimized-routines-defaults"], |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 126 | gtest: false, |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 127 | cflags: ["-Wno-missing-braces"], |
| 128 | srcs: ["math/test/mathtest.c"], |
Haibo Huang | cd7d536 | 2019-07-31 18:22:02 -0700 | [diff] [blame] | 129 | data: ["math/test/testcases/directed/*.tst"], |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 130 | target: { |
Elliott Hughes | e3966aa | 2018-07-26 08:46:15 -0700 | [diff] [blame] | 131 | darwin: { |
| 132 | enabled: false, |
| 133 | }, |
Elliott Hughes | c2e0183 | 2018-07-20 13:55:44 -0700 | [diff] [blame] | 134 | linux_bionic: { |
| 135 | enabled: true, |
| 136 | }, |
| 137 | }, |
| 138 | } |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 139 | |
| 140 | cc_test { |
| 141 | name: "ulp", |
| 142 | defaults: ["arm-optimized-routines-defaults"], |
| 143 | gtest: false, |
| 144 | srcs: ["math/test/ulp.c"], |
| 145 | data: ["math/test/runulp.sh"], |
| 146 | } |
| 147 | |
| 148 | sh_test { |
| 149 | name: "arm-optimized-routines-tests", |
| 150 | src: "run-arm-optimized-routines-tests-on-android.sh", |
| 151 | filename: "run-arm-optimized-routines-tests-on-android.sh", |
| 152 | test_suites: ["general-tests"], |
| 153 | host_supported: true, |
| 154 | device_supported: false, |
frankfeng | 726e3ec | 2020-10-16 13:55:24 -0700 | [diff] [blame] | 155 | require_root: true, |
Elliott Hughes | 3eae8e0 | 2019-12-18 14:17:17 -0800 | [diff] [blame] | 156 | target_required: [ |
| 157 | "mathtest", |
| 158 | "ulp", |
| 159 | ], |
| 160 | } |