summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-05-09 19:21:16 -0700
committerOri Bernstein <ori@eigenstate.org>2018-05-09 19:21:16 -0700
commit3665783a1d1fe03db70cca452c615b439310a329 (patch)
treef01abd14263ccf7cb1c005d383330ddf66b00163 /mbld
parent0f956d6bb55e0455326f4627024c1fa8c8adbff8 (diff)
parent37ba2ec87069c9ca9bfeac71ec4dba660fcadf60 (diff)
downloadmc-3665783a1d1fe03db70cca452c615b439310a329.tar.gz
Merge remote-tracking branch 'npnth/libmath'
Diffstat (limited to 'mbld')
-rw-r--r--mbld/opts.myr8
-rw-r--r--mbld/syssel.myr6
2 files changed, 14 insertions, 0 deletions
diff --git a/mbld/opts.myr b/mbld/opts.myr
index b82921f..5cdc93a 100644
--- a/mbld/opts.myr
+++ b/mbld/opts.myr
@@ -34,7 +34,15 @@ 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
+
+ /*
+ Intel manuals (vol 1, 14.5.3) say AVX, OSXSAVE also
+ needed. For full portability, XGETBV also needs to be
+ checked, though it isn't right now.
+ */
+ const CpuidFMA : uint64= 0x18001000
extern const cpufeatures : (-> uint64)
;;
diff --git a/mbld/syssel.myr b/mbld/syssel.myr
index 756cf4d..636792a 100644
--- a/mbld/syssel.myr
+++ b/mbld/syssel.myr
@@ -162,9 +162,15 @@ 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")
;;
+ if opt_cpufeatures & CpuidFMA == CpuidFMA
+ tag(b, "fma")
+ ;;
| unknown:
std.fatal("unknown architecture {}\n", unknown)
;;