From 04801d1a488528ffadbc58d5186332dc89f5cf73 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 8 May 2019 14:30:53 +0000 Subject: [PATCH] Always inline splat and extract Otherwise the compiler would not inline them and produce instead a pointless call. --- library/stdarch/crates/core_arch/src/simd.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/simd.rs b/library/stdarch/crates/core_arch/src/simd.rs index 568fd1d16dcc..b86a5ff28842 100644 --- a/library/stdarch/crates/core_arch/src/simd.rs +++ b/library/stdarch/crates/core_arch/src/simd.rs @@ -15,8 +15,8 @@ macro_rules! simd_ty { pub(crate) const fn new($($elem_name: $elem_ty),*) -> Self { $id($($elem_name),*) } - - #[inline] + // FIXME: Workaround rust@60637 + #[inline(always)] pub(crate) const fn splat(value: $ety) -> Self { $id($({ #[allow(non_camel_case_types, dead_code)] @@ -25,7 +25,8 @@ macro_rules! simd_ty { }),*) } - #[inline] + // FIXME: Workaround rust@60637 + #[inline(always)] pub(crate) fn extract(self, index: usize) -> $ety { unsafe { crate::core_arch::simd_llvm::simd_extract(self, index as u32) @@ -53,7 +54,8 @@ macro_rules! simd_m_ty { $id($(Self::bool_to_internal($elem_name)),*) } - #[inline] + // FIXME: Workaround rust@60637 + #[inline(always)] pub(crate) const fn splat(value: bool) -> Self { $id($({ #[allow(non_camel_case_types, dead_code)] @@ -62,7 +64,8 @@ macro_rules! simd_m_ty { }),*) } - #[inline] + // FIXME: Workaround rust@60637 + #[inline(always)] pub(crate) fn extract(self, index: usize) -> bool { let r: $ety = unsafe { crate::core_arch::simd_llvm::simd_extract(self, index as u32)