Bug 1397807 - Allow rustc to emit NEON instructions when clang does on ARMv7 and use NEON in encoding_rs. r=glandium
authorHenri Sivonen <hsivonen@hsivonen.fi>
Tue, 05 Jun 2018 14:56:11 +0300
changeset 480111 9a56101afb954d9374cdbfd3101b45c1f082cc7d
parent 480110 346b316a0fe4d127aa059e2ca98d49a0df198d22
child 480112 27257fdd6c6777ca72ac965501da3ef360846bb4
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1397807
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1397807 - Allow rustc to emit NEON instructions when clang does on ARMv7 and use NEON in encoding_rs. r=glandium MozReview-Commit-ID: LNd4jeIGIRg
build/autoconf/arch.m4
config/rules.mk
toolkit/moz.configure
--- 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
@@ -840,20 +840,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)