Bug 1557229 - Add -d16 as a target_feature along +neon for rust code. r=nalexander

When enabling neon (--with-fpu=neon, or when the C++ compiler defaults
to use neon), we pass +neon as a target feature to the rust compiler.
That enables neon in rust, which is the default with the
thumbv7neon-linux-gnueabihf rust target, but not the default for the
armv7-unknown-linux-gnueabihf rust target.

ARM processors may have various different FPUs, with different number of
registers. On ARMv7, there are FPUs with 16 registers and FPUs with 32
registers. NEON requires 32 registers.

Because the common denominator for ARMv7 is 16 registers, the
armv7-unknown-linux-gnueabihf rust target defaults to 16 registers,
although by enabling neon, we're guaranteed the processor will have 32.

But while the rust compiler keeps limited to 16 registers, it also hits
a wall while compiling the hyper crate, where it finds it doesn't have
enough registers (which in itself can be considered a bug).

Since enabling neon means there are 32 registers available, it makes
sense to tell the compiler to lift the restricted use of FPU registers,
and that's what the `-d16` target feature does.

That's the default for the thumbv7neon-linux-gnueabihf rust target, so
nothing is changed, there, and fixes things for the
armv7-unknown-linux-gnueabihf rust target.

Differential Revision: https://phabricator.services.mozilla.com/D33907

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-06-07 00:47:03 +00:00
parent 47925b3f7a
commit d4ea925beb

View File

@ -57,7 +57,9 @@ endif
rustflags_neon =
ifeq (neon,$(MOZ_FPU))
rustflags_neon += -C target_feature=+neon
# Enable neon and disable restriction to 16 FPU registers
# (CPUs with neon have 32 FPU registers available)
rustflags_neon += -C target_feature=+neon,-d16
endif
rustflags_override = $(MOZ_RUST_DEFAULT_FLAGS) $(rustflags_neon)