HomePhabricator

Fix support for user mode emulation when using cmake/lit.

Description

Fix support for user mode emulation when using cmake/lit.

When using user mode emulation, i.e. cross-compiling programs for a
different target and running them on a host under qemu user mode
emulation, timeit and fpcmp should have host versions, not target
versions.

Running under user mode emulation had been broken for a while,
presumably since https://reviews.llvm.org/rT341257

I first tried an alternative approach where fpcmp would be run under qemu user
mode emulation too. That in itself worked, but if going for that approach, for
orthogonality reasons, we probably should also run the other helper programs as
if they were running on the target, i.e. also under qemu user mode emulation.
I ran into issues with running timeit under qemu user mode emulation and also
running RunSafely.sh under user mode emulation doesn't seem trivial.

In the end, it seemed better to me to explicitly add a cmake option to mark
that we're running under qemu user mode emulation, and in that mode, only aim
to run the test/benchmark under qemu user mode emulation, rather than also all
the helper programs (such as fpcmp, timeit, RunSafely.sh) under it (which is
what would be needed if we just kept on using only the RUN_UNDER option for
qemu user mode emulation.

Differential Revision: https://reviews.llvm.org/D61597