From 4bc96b95f0c7d69e66ee59f7523026b4d5b0e08f Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi@cloudius-systems.com>
Date: Sun, 18 Aug 2013 19:30:20 +0300
Subject: [PATCH] libc: drop sse4.1 ceil(), floor()

The dependency on sse4.1 crashes on older cpus, use the generic musl
implementation.
---
 arch/x64/math.cc | 16 ----------------
 libc/build.mk    |  4 ++--
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/x64/math.cc b/arch/x64/math.cc
index 57cba9118..df4c0e176 100644
--- a/arch/x64/math.cc
+++ b/arch/x64/math.cc
@@ -1,22 +1,6 @@
 #include <math.h>
 #include <osv/types.h>
 
-// FIXME: check for sse4.1
-
-double ceil(double v)
-{
-    double r;
-    asm("roundsd $2, %1, %0" : "=x"(r) : "x"(v));
-    return r;
-}
-
-double floor(double v)
-{
-    double r;
-    asm("roundsd $1, %1, %0" : "=x"(r) : "x"(v));
-    return r;
-}
-
 extern "C"
 int __isnan(double v)
 {
diff --git a/libc/build.mk b/libc/build.mk
index 32e978259..2e4b4c3a1 100644
--- a/libc/build.mk
+++ b/libc/build.mk
@@ -165,7 +165,7 @@ libc += math/atanl.o
 libc += math/cbrt.o
 libc += math/cbrtf.o
 libc += math/cbrtl.o
-#libc += math/ceil.o
+libc += math/ceil.o
 libc += math/ceilf.o
 libc += math/ceill.o
 libc += math/copysign.o
@@ -198,7 +198,7 @@ libc += math/fabsl.o
 libc += math/fdim.o
 libc += math/fdimf.o
 libc += math/fdiml.o
-#libc += math/floor.o
+libc += math/floor.o
 libc += math/floorf.o
 libc += math/floorl.o
 #libc += math/fma.o
-- 
GitLab