Use builtins for ceil/floor/rint/trunc on arm64
Change-Id: I5c8be32b4d5a136690a496cddfec7d1fc2b25ee1
diff --git a/libm/Android.bp b/libm/Android.bp
index 6d6fafa..ffb4f47 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -300,13 +300,9 @@
arm64: {
srcs: [
- "arm64/ceil.S",
"arm64/fenv.c",
- "arm64/floor.S",
"arm64/lrint.S",
- "arm64/rint.S",
"arm64/sqrt.S",
- "arm64/trunc.S",
],
exclude_srcs: [
"upstream-freebsd/lib/msun/src/e_sqrt.c",
diff --git a/libm/arm64/ceil.S b/libm/arm64/ceil.S
deleted file mode 100644
index 7217d57..0000000
--- a/libm/arm64/ceil.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <private/bionic_asm.h>
-
-ENTRY(ceil)
- frintP d0, d0
- ret
-END(ceil)
-
-ENTRY(ceilf)
- frintP s0, s0
- ret
-END(ceilf)
diff --git a/libm/arm64/floor.S b/libm/arm64/floor.S
deleted file mode 100644
index ca106bd..0000000
--- a/libm/arm64/floor.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <private/bionic_asm.h>
-
-ENTRY(floor)
- frintM d0, d0
- ret
-END(floor)
-
-ENTRY(floorf)
- frintM s0, s0
- ret
-END(floorf)
diff --git a/libm/arm64/rint.S b/libm/arm64/rint.S
deleted file mode 100644
index bf49f5b..0000000
--- a/libm/arm64/rint.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <private/bionic_asm.h>
-
-ENTRY(rint)
- frintX d0, d0
- ret
-END(rint)
-
-ENTRY(rintf)
- frintX s0, s0
- ret
-END(rintf)
diff --git a/libm/arm64/trunc.S b/libm/arm64/trunc.S
deleted file mode 100644
index aa0d4bd..0000000
--- a/libm/arm64/trunc.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <private/bionic_asm.h>
-
-ENTRY(trunc)
- frintZ d0, d0
- ret
-END(trunc)
-
-ENTRY(truncf)
- frintZ s0, s0
- ret
-END(truncf)
diff --git a/libm/builtins.cpp b/libm/builtins.cpp
index 2ea6305..3b9228c 100644
--- a/libm/builtins.cpp
+++ b/libm/builtins.cpp
@@ -46,6 +46,12 @@
#endif
#if defined(__aarch64__)
+float ceilf(float x) { return __builtin_ceilf(x); }
+double ceil(double x) { return __builtin_ceil(x); }
+
+float floorf(float x) { return __builtin_floorf(x); }
+double floor(double x) { return __builtin_floor(x); }
+
float fmaf(float x, float y, float z) { return __builtin_fmaf(x, y, z); }
double fma(double x, double y, double z) { return __builtin_fma(x, y, z); }
@@ -55,6 +61,12 @@
float fminf(float x, float y) { return __builtin_fminf(x, y); }
double fmin(double x, double y) { return __builtin_fmin(x, y); }
+float rintf(float x) { return __builtin_rintf(x); }
+double rint(double x) { return __builtin_rint(x); }
+
float roundf(float x) { return __builtin_roundf(x); }
double round(double x) { return __builtin_round(x); }
+
+float truncf(float x) { return __builtin_truncf(x); }
+double trunc(double x) { return __builtin_trunc(x); }
#endif