use Singeli's arch.bqn to convert has= to cc flags
This commit is contained in:
parent
4499d93f53
commit
e30973e48b
11
README.md
11
README.md
@ -37,15 +37,20 @@ For native builds, targeted extensions are determined by `/proc/cpuinfo` (or `sy
|
||||
|
||||
### Build flags
|
||||
|
||||
`notui=1` - display build progress in a plain-text format
|
||||
`version=...` - specify the version to report in `--version` (default is commit hash)
|
||||
`nogit=1` - error if something attempts to use `git`
|
||||
`CC=...` - choose a different C compiler (default is `clang`, or `cc` if unavailable; CBQN is more tuned for clang, but gcc also works)
|
||||
`CXX=...` - choose a different C++ compiler; needed only for REPLXX (default is `c++`)
|
||||
`OUTPUT=path/to/somewhere` - change output location; for `emcc-o3` it will be the destination folder for `BQN.js` and `BQN.wasm`, for everything else - the filename
|
||||
`target_arch=(x86-64|aarch64|generic)` - target architecture. Inferred from `uname` by default. Used for deciding target optimizations.
|
||||
`target_os=(linux|bsd|macos|windows)` - target OS. Inferred from `uname` by default. Used for determining default output names and slight configuration changes.
|
||||
`j=8` - override the default parallel job count (default is the output of `nproc`)
|
||||
`notui=1` - display build progress in a plain-text format
|
||||
`version=...` - specify the version to report in `--version` (default is commit hash)
|
||||
`nogit=1` - error if something attempts to use `git`
|
||||
`has=...` - assume specified architecture extensions/properties (x86-64-only). Takes a comma-separated list which, beyond what is architecturally guaranteed, infer additional extensions as noted which hold on existing hardware (at least as of the time of writing):
|
||||
- `pclmul` (implies SSE4.2)
|
||||
- `avx2` (implies `pclmul`, POPCNT, BMI1)
|
||||
- `bmi2` (implies `pclmul`, AVX1)
|
||||
- `slow-pdep` (specifies Zen 1 & Zen 2's slow `pdep`/`pext`)
|
||||
|
||||
`REPLXX=0` - disable REPLXX
|
||||
`singeli=0` - disable usage of Singeli
|
||||
|
||||
@ -162,7 +162,7 @@ po ← { # parsed options
|
||||
emcc, wasm, replxx, singeli, staticLib,
|
||||
usz, ffi, o3, debug, rtverify, heapverify,
|
||||
bytecodeDir, replxxDir, singeliDir,
|
||||
CBQNc, ccColor, singeliFlags, REPLXXc, Linker
|
||||
CBQNc, ccColor, singeliFlags, singeliArch, REPLXXc, Linker
|
||||
⟩⇐
|
||||
|
||||
compat ← GetOpt "from-makefile"
|
||||
@ -237,6 +237,7 @@ po ← { # parsed options
|
||||
{𝕊: "Error: Unsupported 'has' options; options:"∾1↓∾", "⊸∾¨𝕩}_assert_(∧´has∊⊢) "avx2"‿"bmi2"‿"pclmul"‿"slow-pdep"
|
||||
{𝕊: "Error: Cannot have 'has' options on architecture '"∾arch∾"'; remove 'has=...' or add an argument of "∾compat⊑"arch=x86-64"‿"target_arch=x86-64"}_assert_¬ (arch≢"x86-64") ∧ 0≠≠has
|
||||
|
||||
singeliArch ⇐ ({"x86-64":"X86_64"; "aarch64":"AARCH64"; "none"} arch) <⊸∾ Uppercase ∊⟜"avx2"‿"bmi2"‿"pclmul"⊸/ has
|
||||
avx2 ⇐ (arch≡"x86-64") ∧ singeli ∧ native ∨ ⊑"avx2"<⊸∊has
|
||||
|
||||
{𝕊: "Target: "∾os∾" "∾arch∾ 1↓ ∾", "⊸∾¨ has∾native/⋈"native"} _verboseLog@
|
||||
@ -312,7 +313,6 @@ po ← { # parsed options
|
||||
args∾↩ ( replxx) / ⟨"-DUSE_REPLXX", "-DREPLXX_STATIC=1", "-I"∾replxxDir∾"/include"⟩ # TODO maybe move to main.c only, and have it be in its own separate cache dir, so that adding replxx doesn't recompile everything?
|
||||
args∾↩ ( debug DOpt "g") / ⟨"-g"⟩
|
||||
args∾↩ ( o3) / ⟨"-O3"⟩
|
||||
args∾↩ ( native) / ⟨"-march=native"⟩
|
||||
args∾↩ ( debug) / ⟨"-DDEBUG"⟩
|
||||
args∾↩ ( rtverify) / ⟨"-DRT_VERIFY"⟩
|
||||
args∾↩ ( heapverify) / ⟨"-DHEAP_VERIFY"⟩
|
||||
@ -325,7 +325,13 @@ po ← { # parsed options
|
||||
args∾↩ (replxx ∧ windows) / ⟨"-DUSE_REPLXX_IO"⟩
|
||||
args∾↩ ( @≢versionName) / ⟨"-DHAS_VERSION"⟩
|
||||
args∾↩ ( usz≡64) / ⟨"-DUSZ_64"⟩
|
||||
args∾↩ {"slow-pdep": "-DSLOW_PDEP"; "-m"∾𝕩}¨ has
|
||||
args∾↩ (∨´"slow-pdep"⊸≡¨ has) / ⟨"-DSLOW_PDEP"⟩
|
||||
args∾↩ {
|
||||
native? ⟨"-march=native"⟩;
|
||||
⟨⟩: ⟨⟩;
|
||||
"Error: Cannot use has=... if Singeli isn't enabled"_assert_⊢ singeli
|
||||
(⟨singeliArch, 1⟩ •Import AtRoot singeliDir •file.At "arch.bqn").GetCFlags@
|
||||
} has
|
||||
args ↩ args (¬∘∊/⊣) GetOpt "rm_f"
|
||||
{"CBQN C compiler: "∾•Repr 𝕩} _verboseLog args
|
||||
args
|
||||
@ -690,7 +696,7 @@ cachedBin‿linkerCache ← {
|
||||
|
||||
singeliArgs ← po.singeliFlags∾⟨"-l", "gen="∾AtRoot singeliCache.folder, "-c", "usz=u"∾•Repr po.usz⟩∾{
|
||||
po.native? ⟨⟩;
|
||||
"-a" ⋈ ({"x86-64":"X86_64"; "aarch64":"AARCH64"; "none"} po.arch) ∾ ∾ ','⊸∾¨ Uppercase ∊⟜"avx2"‿"bmi2"‿"pclmul"⊸/po.has
|
||||
"-a" ⋈ 1↓∾ ','⊸∾¨ po.singeliArch
|
||||
}
|
||||
{𝕊: "Singeli args: "∾•Repr singeliArgs} _verboseLog @
|
||||
singeliObjs ↩ {MakeSingeliInv ⟨singeliArgs, {𝕊:UpdateSubmodule po.singeliDir}, singeliCache, 𝕩, "src/singeli/src/"•file.At 𝕩∾".singeli", (𝕩≡"dyarith")/⟨gaRule⟩⟩}¨ 1⊑¨singeliMap
|
||||
|
||||
Loading…
Reference in New Issue
Block a user