From patchwork Wed Apr 22 17:49:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?FR=C3=89D=C3=89RIC_RECOULES?= X-Patchwork-Id: 19173 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 25E6D44B3E1 for ; Wed, 22 Apr 2020 20:57:06 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F248B68BCAE; Wed, 22 Apr 2020 20:57:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp.smtpout.orange.fr (smtp11.smtpout.orange.fr [80.12.242.133]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E2AB68BAFD for ; Wed, 22 Apr 2020 20:56:59 +0300 (EEST) Received: from is232189.intra.cea.fr ([46.193.2.18]) by mwinf5d22 with ME id VtpN220080PJwDa03tpPaT; Wed, 22 Apr 2020 19:49:23 +0200 X-ME-Helo: is232189.intra.cea.fr X-ME-Auth: ZnJlZGVyaWMucmVjb3VsZXNAb3JhbmdlLmZy X-ME-Date: Wed, 22 Apr 2020 19:49:23 +0200 X-ME-IP: 46.193.2.18 From: frederic.recoules@univ-grenoble-alpes.fr To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Apr 2020 19:49:14 +0200 Message-Id: <20200422174918.7290-1-frederic.recoules@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/5] [inline assembly] prepares for contiguous assembly statements merging X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Recoules?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Frédéric Recoules --- libavcodec/x86/inline_asm.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/libavcodec/x86/inline_asm.h b/libavcodec/x86/inline_asm.h index 0198746719..6ead73ac33 100644 --- a/libavcodec/x86/inline_asm.h +++ b/libavcodec/x86/inline_asm.h @@ -23,13 +23,15 @@ #include "constants.h" -#define MOVQ_WONE(regd) \ - __asm__ volatile ( \ - "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ - "psrlw $15, %%" #regd ::) +#define MOVQ_WONE_TPL(regd) \ + "pcmpeqd %%"#regd", %%"#regd" \n\t" \ + "psrlw $15, %%" #regd" \n\t" +#define MOVQ_WONE(regd) __asm__ volatile (MOVQ_WONE_TPL(regd) ::) #define JUMPALIGN() __asm__ volatile (".p2align 3"::) -#define MOVQ_ZERO(regd) __asm__ volatile ("pxor %%"#regd", %%"#regd ::) + +#define MOVQ_ZERO_TPL(regd) "pxor %%"#regd", %%"#regd" \n\t" +#define MOVQ_ZERO(regd) __asm__ volatile (MOVQ_ZERO_TPL(regd) ::) #define MOVQ_BFE(regd) \ __asm__ volatile ( \ @@ -37,17 +39,20 @@ "paddb %%"#regd", %%"#regd" \n\t" ::) #ifndef PIC -#define MOVQ_WTWO(regd) __asm__ volatile ("movq %0, %%"#regd" \n\t" :: "m"(ff_pw_2)) +#define MOVQ_WTWO_TPL(regd) "movq %[ff_pw_2], %%"#regd" \n\t" +#define MOVQ_WTWO_IN [ff_pw_2] "m" (ff_pw_2) +#define COMMA_MOVQ_WTWO_IN , MOVQ_WTWO_IN #else // for shared library it's better to use this way for accessing constants // pcmpeqd -> -1 -#define MOVQ_WTWO(regd) \ - __asm__ volatile ( \ - "pcmpeqd %%"#regd", %%"#regd" \n\t" \ - "psrlw $15, %%"#regd" \n\t" \ - "psllw $1, %%"#regd" \n\t"::) - +#define MOVQ_WTWO_TPL(regd) \ + "pcmpeqd %%"#regd", %%"#regd" \n\t" \ + "psrlw $15, %%"#regd" \n\t" \ + "psllw $1, %%"#regd" \n\t" +#define MOVQ_WTWO_IN +#define COMMA_MOVQ_WTWO_IN #endif +#define MOVQ_WTWO(regd) __asm__ volatile (MOVQ_WTWO_TPL(regd) :: MOVQ_WTWO_IN) // using regr as temporary and for the output result // first argument is unmodified and second is trashed