diff options
author | S. Gilles <sgilles@math.umd.edu> | 2018-03-29 00:37:58 -0400 |
---|---|---|
committer | S. Gilles <sgilles@math.umd.edu> | 2018-03-29 00:37:58 -0400 |
commit | 55f8d064387dcf0229b6020d5a8e57e660d358c7 (patch) | |
tree | 06120118c3eb9da3ae7585c6865c795d24bd8b69 | |
parent | 959b473779673322fbef51385a1cf730e73c7aac (diff) | |
download | mc-55f8d064387dcf0229b6020d5a8e57e660d358c7.tar.gz |
Implement sqrt in asm.
-rw-r--r-- | lib/math/bld.sub | 1 | ||||
-rw-r--r-- | lib/math/sqrt-impl+posixy-x64-sse2.s | 13 | ||||
-rw-r--r-- | mbld/opts.myr | 1 | ||||
-rw-r--r-- | mbld/syssel.myr | 3 |
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") ;; |