Bug 1770919 - Allow ARM64 simulator to run on ARM64. r=nbp

Remove the gating in moz.configure that prevents the arm64 simulator from
being compiled on an arm64 system.

Avoid using the fjcvt instruction when running on arm64 hardware, since
the simulator does not appear to support it while cpu detection does
support it.  (The alternative would be to implement the instruction
on the simulator.)

Differential Revision: https://phabricator.services.mozilla.com/D147199
This commit is contained in:
Lars T Hansen 2022-05-27 06:40:33 +00:00
parent 61de9e873b
commit dd892c6dd1
2 changed files with 12 additions and 5 deletions

View File

@ -202,8 +202,8 @@ def simulator(jit_enabled, simulator_enabled, target):
die("The %s simulator only works on x86." % sim_cpu)
if sim_cpu in ("arm64", "mips64", "loong64"):
if target.cpu != "x86_64":
die("The %s simulator only works on x86-64." % sim_cpu)
if target.cpu != "x86_64" and target.cpu != "aarch64":
die("The %s simulator only works on x86-64 or arm64." % sim_cpu)
return namespace(**{sim_cpu: True})

View File

@ -573,9 +573,16 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
ARMFPRegister fsrc64(src, 64);
ARMRegister dest32(dest, 32);
// ARMv8.3 chips support the FJCVTZS instruction, which handles
// exactly this logic.
if (CPUHas(vixl::CPUFeatures::kFP, vixl::CPUFeatures::kJSCVT)) {
// ARMv8.3 chips support the FJCVTZS instruction, which handles exactly this
// logic. But the simulator does not implement it, and when the simulator
// runs on ARM64 hardware we want to override vixl's detection of it.
#if defined(JS_SIMULATOR_ARM64) && (defined(__aarch64__) || defined(_M_ARM64))
const bool fjscvt = false;
#else
const bool fjscvt =
CPUHas(vixl::CPUFeatures::kFP, vixl::CPUFeatures::kJSCVT);
#endif
if (fjscvt) {
// Convert double to integer, rounding toward zero.
// The Z-flag is set iff the conversion is exact. -0 unsets the Z-flag.
Fjcvtzs(dest32, fsrc64);