[vlc-devel] [PATCH 1/1] arm: fix assembling with llvm's integrated assembler for ios

Martin Storsjö martin at martin.st
Tue Feb 6 22:54:55 CET 2018


On Tue, 6 Feb 2018, Janne Grunau wrote:

> ---
> modules/arm_neon/amplify.S                     |  8 ++++--
> modules/arm_neon/asm.S                         | 31 +++++++++++++++++++++
> modules/arm_neon/deinterleave_chroma.S         | 10 ++++---
> modules/arm_neon/i420_rgb.S                    | 10 ++++---
> modules/arm_neon/i420_rv16.S                   | 10 ++++---
> modules/arm_neon/i420_yuyv.S                   | 14 +++++-----
> modules/arm_neon/i422_yuyv.S                   | 14 +++++-----
> modules/arm_neon/nv12_rgb.S                    | 10 ++++---
> modules/arm_neon/nv21_rgb.S                    | 10 ++++---
> modules/arm_neon/simple_channel_mixer.S        | 38 +++++++++-----------------
> modules/arm_neon/yuyv_i422.S                   | 14 +++++-----
> modules/video_filter/deinterlace/merge_arm.S   | 20 ++++++--------
> modules/video_filter/deinterlace/merge_arm64.S | 10 +++----
> 13 files changed, 112 insertions(+), 87 deletions(-)
> create mode 100644 modules/arm_neon/asm.S
>
> diff --git a/modules/arm_neon/amplify.S b/modules/arm_neon/amplify.S
> index 5938118378..711a3ea4f7 100644
> --- a/modules/arm_neon/amplify.S
> +++ b/modules/arm_neon/amplify.S
> @@ -18,18 +18,20 @@
>  @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>  @****************************************************************************/
> 
> +#include "asm.S"
> +
> 	.syntax	unified
> 	.arm
> +#ifndef __APPLE__
> 	.fpu	neon
> +#endif
> 	.text

Or maybe go for #ifdef __ELF__, since this isn't supported when targeting 
windows either. (My arm/clang/win builds don't seem to have enabled the 
arm_neon modules though so I haven't touched this code wrt that yet.)

> 
> #define	DST	r0
> #define	SRC	r1
> #define	SIZE	r2
> 	.align 2
> -	.global amplify_float_arm_neon
> -	.type	amplify_float_arm_neon, %function
> -amplify_float_arm_neon:
> +function amplify_float_arm_neon
> 	cmp		SIZE,	#0
> 	bxeq		lr
> #ifdef __ARM_PCS
> diff --git a/modules/arm_neon/asm.S b/modules/arm_neon/asm.S
> new file mode 100644
> index 0000000000..427e80715d
> --- /dev/null
> +++ b/modules/arm_neon/asm.S
> @@ -0,0 +1,31 @@
> +/*
> + * Copyright (c) 2018 Janne Grunau <janne-libav at jannau.net>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifdef __APPLE__
> +#   define EXTERN_ASM _
> +#else
> +#   define EXTERN_ASM
> +#endif
> +
> +.macro  function name
> +	.globl  EXTERN_ASM\name
> +#ifdef __ELF__
> +	.type   EXTERN_ASM\name, %function
> +#endif
> +EXTERN_ASM\name:
> +.endm
> diff --git a/modules/arm_neon/deinterleave_chroma.S b/modules/arm_neon/deinterleave_chroma.S
> index 019d647ed6..509120b920 100644
> --- a/modules/arm_neon/deinterleave_chroma.S
> +++ b/modules/arm_neon/deinterleave_chroma.S
> @@ -19,8 +19,12 @@
>  @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>  @****************************************************************************/
> 
> +#include "asm.S"
> +
> 	.syntax unified
> -	.fpu neon
> +#ifndef __APPLE__
> +	.fpu	neon
> +#endif
> 	.text
>

Ditto (or maybe fold this part into asm.S?)

> diff --git a/modules/video_filter/deinterlace/merge_arm.S b/modules/video_filter/deinterlace/merge_arm.S
> index dd779029ae..3694ff6de2 100644
> --- a/modules/video_filter/deinterlace/merge_arm.S
> +++ b/modules/video_filter/deinterlace/merge_arm.S
> @@ -18,10 +18,14 @@
>  @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>  @****************************************************************************/
> 
> +#include "../arm_neon/asm.S"
> +
> 	.syntax	unified
> 	.arm
> +#ifndef __APPLE__
> 	.arch	armv6
> 	.fpu	neon
> +#endif

Ok, so here it's a slightly different prologue, so sharing it would 
require parameters for .arch anyway... Hmm.

> diff --git a/modules/video_filter/deinterlace/merge_arm64.S b/modules/video_filter/deinterlace/merge_arm64.S
> index db19e54caf..7b70678891 100644
> --- a/modules/video_filter/deinterlace/merge_arm64.S
> +++ b/modules/video_filter/deinterlace/merge_arm64.S
> @@ -19,6 +19,8 @@
>  // Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
>  //****************************************************************************/
> 
> +#include "../../arm_neon/asm.S"
> +
> 	.text
> 
> #define	DEST	x0

Including an arm source file in an arm64 assembly file feels a bit icky, 
even though the current macros are perfectly shareable. (If you'd move 
more of the prologue there, it wouldn't be quite as shareable though.)

// Martin


More information about the vlc-devel mailing list