[sl-core] Provide compiler built-ins for ffs() on MT-SPARC.

These are required by dlmalloc(). This support enables
running MGSim's compiled unit tests.

* lib/mtsparc-sim/builtin_ffs.c (__ffssi2, __ffsdi2): New.
* lib/mtsparc-sim/Makefile.am: Build `libgcc.a' from it.
[sl-core] Extend the library with more ffs/fls functions.

* lib/libc/include/strings.h: Declare ffsl, ffsll, fsl, fsll,
fslll.

* lib/libc/string/ffs.c: Delete, replace by...
* lib/libc/bsd/libc/string/ffs.c: ... this. (imported from
FreeBSD)
* lib/libc/bsd/libc/string/ffsl.c,
* lib/libc/bsd/libc/string/ffsll.c,
* lib/libc/bsd/libc/string/fls.c,
* lib/libc/bsd/libc/string/flsl.c,
* lib/libc/bsd/libc/string/flsll.c: Import from FreeBSD.

* lib/libc.mk: Include them in `libc.a'.
[sl-core] Provide some compiler intrinsics for MT-SPARC.

* lib/mtsparc-sim/builtin_ffs.c: Remove. Replace by...
* lib/mtsparc-sim/div.h,
* lib/mtsparc-sim/clzdi2.c,
* lib/mtsparc-sim/clzsi2.c,
* lib/mtsparc-sim/ctzdi2.c,
* lib/mtsparc-sim/ctzsi2.c,
* lib/mtsparc-sim/divdi3.c,
* lib/mtsparc-sim/ffsdi2.c,
* lib/mtsparc-sim/ffssi2.c,
* lib/mtsparc-sim/moddi3.c,
* lib/mtsparc-sim/udivdi3.c,
* lib/mtsparc-sim/umoddi3.c: ... these new files.
* lib/mtsparc-sim/Makefile.am: Use them to define `libgcc.a'.
[sl-core] Minor packaging fix.

* build-aux/slc.m4: Also place `$srcdir/lib' in `SLC_LIBDIR' so that
`cce' can find a precompiled `libgcc.a'.
[sl-core] Tell MGSim about register aliases for easier debugging.

Recent MGSim versions are able to list register aliases next to
the physical register names when inspecting the register file. The
list of aliases is configurable, and defaults to the ISA's
standard ABI names. Since `slc' uses non-standard register mappings,
it is thus useful to tell MGSim about our choices when running
with `slr'.

* tools/slc/mt/common/compile.py (Compile.showregs),
* tools/slc/mt/mipsel/compile.py (Compile.showregs): New: list the
mapping from local registers to legacy register aliases.

* tools/bin/spp: Recognize a new function `showregs' which invokes
`compile.showregs' to list mappings to local registers to aliases.

* tools/runscripts.mk: Also substitute '@mtarch@' to a name suitable
for use with `spp' (name of submodule of `slc.mt').

* tools/r-mt-sim.sh.in: Use `spp' to pass the options
`IntRegAliases' and `FltRegAliases' to MGSim.
[sl-core] Simplify the MGSim run scripts.

Recent MGSim versions are able to read the symbol table
automatically from the ELF executable. Therefore, `slr' does not
need to prepare the symbol table itself any more.

* build-aux/mgbinutils.m4,
* tools/runscripts.mk: Do not propagate `nm' any more.

* tools/r-mt-sim.sh.in: Simplify.
[sl-core] Fix an assembly generation bug on MT-SPARC.

The MT-SPARC assembler needs to know when the effects of
`.registers' stop with `.noregisters', so as to translate register
names outside of MT mode properly. Prior to this patch
`.noregisters' was not generated and assembler warnings would
ensue.

* tools/slc/mt/mtsparc/asmproc/base.py (grouper): Add
`.noregisters' at the end of MT functions.
[sl-core] Drop support for "slr variables".

This mechanism can be advantageously replaced by command-line
arguments passed to `main' (argc/argv) or Fibre input.

* tools/include/svp/slr.h: Remove.
* tools/slc.mk (nobase_dist_pkgdata_DATA): Update accordingly.

* tools/bin/slr.in: Do not recognize the command-line
arguments. Do not prepare the data.

* tools/lib/mt/mipsel/slrt.s,
* tools/lib/mt/mta/slrt.s,
* tools/r-mt-sim.sh.in,
* tools/r-host.sh.in,
* tools/r-mtsparc-fpga.sh.in: Do not pass the data.

* tools/lib/host/load.c,
* lib/mgos/init/mtinit.c,
* lib/mgos/input/mtinput.c: Do not initialize the var data.
[sl-core] Synchronize library support with the latest MGSim sources.

* lib/mgos/mgsim/mgsim.h,
* lib/mgos/mgsim/mtconf.c: Import from MGSim. This uses
memory-mapped I/O for ASRs/APRs and the global heap for the
configuration data.
[sl-core] Preliminary support for floating-point for MT-SPARC.

At this point we force `double' to single precision because MT
argument passing can only use 1 register and 64-bit doubles would
require 2 registers. (To overcome this, either FP arguments should
be passed via memory, or a new mechanism must be devised to split
the values across two registers.)

Note that the MT binutils must be upgraded, as the versions prior
to this date used an invalid locals offset for FP registers.

* tools/bin/cce.in: Re-enable hardware floating-point, but forcing
single precision only with -fshort-double.

* tools/slc/mt/common/regmagic.py: Use separate `mt_locals_offset'
for integer and FP registers. This is required because (at least)
on SPARC FP register %f0 is a regular register, not zero, so it
should not be offset when mapping to locals.

* tools/slc/mt/mtalpha/regdefs.py: Set the FP locals offset to 0.

* tools/slc/mt/mtsparc/regdefs.py: Define mappings for
floating-point registers. Define the FP locals offset to 0
(integer locals offset stays 1 since %g0 is zero).
[sl-core] Optimize the conversion of Fibre input to binary data.

* tools/bin/sag: Emit output data directly. This requires to know
the data layout (big endian vs little endian, 32-bit vs 64-bit longs,
32-bit doubles vs 64-bit doubles).

* tools/bin/slr.in: Use it. Fetch the data layout from the `slr_datatag'.
* tools/r-host.sh.in,
* tools/r-mt-sim.sh.in: Simplify, since recursion is not needed
any more.

* tools/lib/host/slrt.c,
* tools/lib/mt/mipsel/slrt.s,
* tools/lib/mt/mta/slrt.s,
* tools/lib/mt/mts/slrt.s: Set the data layout.

* tools/arggen.c,
* tools/mt-profiles/arggen: Remove, as they are not obsolete.
* tools/slc.mk: Update accordingly.
[sl-core] Provide more compatibility with MT-SPARC's single-precision FP support.

* lib/libc/misc/dtoa_simple.c (dtoa_simple): Avoid using large
exponents when using short doubles.
[sl-core] Simplify the MT-Alpha slrt.

* tools/lib/mt/mta/slrt.s: Do not initialize the registers to
zero, since D-RISC automatically reads zero from locals.
[sl-core] Enhance the MT-SPARC slrt.

* tools/lib/mt/mts/slrt.s: Enhance to use the same initialization
strategy as MT-Alpha and MIPSel. This enables common system
initialization.
[sl-core] Simplify the test suites.

* build-aux/slctest.m4: Disable support for muTC core compiler,
`ppp' translation and separate ZLCOMA testing. The latter can be
tested using SIMPROFILE anyways.
* build-aux/slctests.mk: Update accordingly.
[sl-core] Add support for `-nostdinc' to `slc'.

This is required to compile uCLibc, which provides its own
`math.h'.

* tools/bin/slc.in,
* tools/bin/cce.in: Do it.
[sl-core] Fix a bug in the MT-SPARC slrt.

* tools/lib/mt/mts/slrt.s: Ensure the `slr_runner' tag is prefixed
with a nul byte.
[sl-core] Minor packaging fixes.

* tools/runscripts.mk: Propagate @spp_helper@ to the
scripts. Factor the common substitutions.
* tools/slc.mk: Distribute `slc/mt/mipsel/compile.py'.
[sl-core] Fix some FP-related MT-SPARC code generation bugs.

* tools/slc/mt/common/gentfun.py (TFun_2_MTFun.visit_setp):
Determine which FP register-to-register move instruction to use
from the regmagic (e.g. `fmov' is not valid on MT-SPARC).

* tools/slc/mt/mtalpha/regdefs.py,
* tools/slc/mt/mtsparc/regdefs.py: Define the instruction
mnemonics here.

* tools/slc/mt/mtsparc/gencreate.py: Propagate FP globals/shareds
to the child family.
[sl-tests] Simplify the test suite.

* 0_slc/1_create/sp1.c,
* 0_slc/1_create/sprec.c: Do not test on MT-SPARC, which does not
support spawn/spawnsync.

* 1_slr/bigdata.c,
* 1_slr/multiargs.c: Remove, since the "slr vars" mechanism
has been removed.

* 1_slr/args.c,
* 0_slc/3_index/common.h: Use `getopt' instead of "slr vars".
* 0_slc/3_index/neg1.c,
* 0_slc/3_index/neg2.c,
* 0_slc/3_index/neg3.c,
* 0_slc/3_index/neg4.c,
* 0_slc/3_index/neg5.c,
* 0_slc/3_index/neg6.c,
* 0_slc/3_index/neg7.c,
* 0_slc/3_index/neg8.c,
* 0_slc/3_index/pos9.c,
* 0_slc/3_index/pos1.c,
* 0_slc/3_index/pos2.c,
* 0_slc/3_index/pos3.c,
* 0_slc/3_index/pos4.c,
* 0_slc/3_index/pos5.c,
* 0_slc/3_index/pos6.c,
* 0_slc/3_index/pos7.c,
* 0_slc/3_index/pos8.c,
* 0_slc/3_index/pos9.c: Update accordingly.

* 2_lib/math/avail.c: Use `getopt' instead of "slr vars". Also
ignore output on MT-SPARC which has only single-precision doubles
for now.
* 2_lib/math/tgamma.c: Use Fibre input instead of "slr
vars". Ignore output on MT-SPARC.