summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/math/bld.sub1
-rw-r--r--lib/math/sqrt-impl+posixy-x64-sse2.s13
-rw-r--r--mbld/opts.myr1
-rw-r--r--mbld/syssel.myr3
4 files changed, 18 insertions, 0 deletions
diff --git a/lib/math/bld.sub b/lib/math/bld.sub
index 06c73bd..4f6663c 100644
--- a/lib/math/bld.sub
+++ b/lib/math/bld.sub
@@ -6,6 +6,7 @@ lib math =
fma-impl.myr
# sqrt
+ sqrt-impl+posixy-x64-sse2.s
sqrt-impl.myr
# trunc, floor, ceil
diff --git a/lib/math/sqrt-impl+posixy-x64-sse2.s b/lib/math/sqrt-impl+posixy-x64-sse2.s
new file mode 100644
index 0000000..a219082
--- /dev/null
+++ b/lib/math/sqrt-impl+posixy-x64-sse2.s
@@ -0,0 +1,13 @@
+.globl math$sqrt32
+.globl math$_sqrt32
+math$sqrt32:
+math$_sqrt32:
+ sqrtss %xmm0, %xmm0
+ ret
+
+.globl math$sqrt64
+.globl math$_sqrt64
+math$sqrt64:
+math$_sqrt64:
+ sqrtsd %xmm0, %xmm0
+ ret
diff --git a/mbld/opts.myr b/mbld/opts.myr
index 8956338..5cdc93a 100644
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -34,6 +34,7 @@ pkg bld =
const parseversion : (v : byte[:] -> (int, int, int))
/* not exactly portable, but good enough for now */
+ const CpuidSSE2 : uint64= 0x400000000000000
const CpuidSSE4 : uint64= 0x180000
/*
diff --git a/mbld/syssel.myr b/mbld/syssel.myr
index f0223ca..636792a 100644
--- a/mbld/syssel.myr
+++ b/mbld/syssel.myr
@@ -162,6 +162,9 @@ const addsysattrs = {b, tags
match opt_arch
| "x64":
tag(b, "x64")
+ if opt_cpufeatures & CpuidSSE2 == CpuidSSE2
+ tag(b, "sse2")
+ ;;
if opt_cpufeatures & CpuidSSE4 == CpuidSSE4
tag(b, "sse4")
;;