Bug 1397807 - Allow rustc to emit NEON instructions when clang does on ARMv7 and use NEON in encoding_rs.
MozReview-Commit-ID: LNd4jeIGIRg
--- a/build/autoconf/arch.m4
+++ b/build/autoconf/arch.m4
@@ -262,10 +262,11 @@ if test "$CPU_ARCH" = "arm"; then
fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
AC_SUBST(BUILD_ARM_NEON)
AC_SUBST(ARM_ARCH)
AC_SUBST_LIST(NEON_FLAGS)
+AC_SUBST(MOZ_FPU)
])
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -842,17 +842,22 @@ ifndef MOZ_DEBUG_RUST
cargo_rustc_flags += -C lto
endif
endif
ifdef CARGO_INCREMENTAL
cargo_incremental := CARGO_INCREMENTAL=$(CARGO_INCREMENTAL)
endif
-rustflags_override = RUSTFLAGS='$(MOZ_RUST_DEFAULT_FLAGS) $(RUSTFLAGS)'
+rustflags_neon =
+ifeq (neon,$(MOZ_FPU))
+rustflags_neon += -C target_feature=+neon
+endif
+
+rustflags_override = RUSTFLAGS='$(MOZ_RUST_DEFAULT_FLAGS) $(RUSTFLAGS) $(rustflags_neon)'
ifdef MOZ_MSVCBITS
# If we are building a MozillaBuild shell, we want to clear out the
# vcvars.bat environment variables for cargo builds. This is because
# a 32-bit MozillaBuild shell on a 64-bit machine will try to use
# the 32-bit compiler/linker for everything, while cargo/rustc wants
# to use the 64-bit linker for build.rs scripts. This conflict results
# in a build failure (see bug 1350001). So we clear out the environment
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -837,20 +837,19 @@ set_config('MOZ_ENABLE_WEBRENDER', webre
# SIMD acceleration for Rust code (currently just encoding_rs)
option('--enable-rust-simd', env='MOZ_RUST_SIMD',
help='Enable explicit SIMD in Rust code.')
@depends('--enable-rust-simd', target)
def rust_simd(value, target):
- # As of 2017-06-13, the simd crate only works on aarch64,
- # x86 and x86_64. It's meant to work on 32-bit ARM, too,
- # but currently does not.
- if target.cpu in ('aarch64', 'x86', 'x86_64') and value:
+ # As of 2018-06-05, the simd crate only works on aarch64,
+ # armv7, x86 and x86_64.
+ if target.cpu in ('aarch64', 'arm', 'x86', 'x86_64') and value:
return True
set_config('MOZ_RUST_SIMD', rust_simd)
set_define('MOZ_RUST_SIMD', rust_simd)
# Printing
# ==============================================================
@depends(target)