From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C272C54FD0 for ; Mon, 27 Apr 2020 13:48:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1531A20656 for ; Mon, 27 Apr 2020 13:48:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="pFOGUG0i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1531A20656 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 62C011684; Mon, 27 Apr 2020 15:47:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 62C011684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587995289; bh=E/wDEV3aXLeT+Ai/s+zQtJa3krJQvuXWqloaU9sH/Lc=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pFOGUG0ihyuTE3C2T/qroaN/zPH+etE03sS14F1kIzGk0IhzqUKbjsS4ev1M802Mc oimN8plGANXvNabJAqmzBMvxtDYix4kP/WUKvpoS5i0x+5UiV/odLM8eZJKJclRJvH a2E/UhCi3uJBmSGUa0jb1irfrC8sbckUj95KZzY8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D641EF80217; Mon, 27 Apr 2020 15:47:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3C87AF8022B; Mon, 27 Apr 2020 15:47:12 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ECEE7F80113 for ; Mon, 27 Apr 2020 15:47:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ECEE7F80113 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BE006AC50; Mon, 27 Apr 2020 13:47:02 +0000 (UTC) Date: Mon, 27 Apr 2020 15:47:02 +0200 Message-ID: From: Takashi Iwai To: frederic.recoules@univ-grenoble-alpes.fr Subject: Re: [PATCH] [inline assembly] fix pcm_dmix_i386.h assembly chunk interfaces In-Reply-To: <20200427073604.26662-1-frederic.recoules@univ-grenoble-alpes.fr> References: <20200427073604.26662-1-frederic.recoules@univ-grenoble-alpes.fr> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: alsa-devel@alsa-project.org, =?UTF-8?B?RnLDqWTDqXJpYw==?= Recoules X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, 27 Apr 2020 09:36:04 +0200, frederic.recoules@univ-grenoble-alpes.fr wrote: > > From: Frédéric Recoules > > Main changes are: > - move 'size' and 'old_ebx' to the output list since they are clobbered > - add the "memory" keyword since input pointers are dereferenced > - add mmx registers in the clobber list and add an initialization for mm1 > - add ebx in clobbers via a set of macro when GCC is newer than 5.0 > (it will work for other compilers or non-PIC mode too) > > Minor changes are: > - keep consistent the token numbering in the template > - remove the manual save/restore ebx when it is in the clobber list > - allows 'dst_step', 'src_step' and 'sum_step' to be given by immediates > - allows 'size' to be given by register (e.g. ebp) > - add "cc" keyword since the eflag register is clobbered > > Signed-off-by: Frédéric Recoules When I apply this and build for i386 with gcc9, I got the following error: pcm_dmix_i386.h: In function 'mix_areas_16_mmx': pcm_dmix_i386.h:180:2: error: unknown register name 'mm1' in 'asm' 180 | __asm__ __volatile__ ( | ^~~~~~~ pcm_dmix_i386.h:180:2: error: unknown register name 'mm0' in 'asm' In file included from pcm_dmix_i386.c:31, from pcm_dmix.c:144: pcm_dmix_i386.h: In function 'remix_areas_16_mmx': pcm_dmix_i386.h:180:2: error: unknown register name 'mm1' in 'asm' 180 | __asm__ __volatile__ ( | ^~~~~~~ .... Could you check those errors? thanks, Takashi > --- > src/pcm/pcm_dmix_i386.h | 168 ++++++++++++++++++++++------------------ > 1 file changed, 93 insertions(+), 75 deletions(-) > > diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h > index 2778cb1d..af2f4630 100644 > --- a/src/pcm/pcm_dmix_i386.h > +++ b/src/pcm/pcm_dmix_i386.h > @@ -26,6 +26,13 @@ > * > */ > > +#define COMMA , > +#if __GNUC__ < 5 && defined(__PIC__) > +# define GCC_PIC_SWITCH(before,after) before > +#else > +# define GCC_PIC_SWITCH(before,after) after > +#endif > + > /* > * for plain i386 > */ > @@ -47,13 +54,14 @@ static void MIX_AREAS_16(unsigned int size, > __asm__ __volatile__ ( > "\n" > > - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %%ebx, %1\n",) > /* > * initialization, load ESI, EDI, EBX registers > */ > - "\tmovl %1, %%edi\n" > - "\tmovl %2, %%esi\n" > - "\tmovl %3, %%ebx\n" > + "\tmovl %2, %%edi\n" > + "\tmovl %3, %%esi\n" > + "\tmovl %4, %%ebx\n" > "\tcmpl $0, %0\n" > "\tjnz 2f\n" > "\tjmp 7f\n" > @@ -64,9 +72,9 @@ static void MIX_AREAS_16(unsigned int size, > */ > "\t.p2align 4,,15\n" > "1:" > - "\tadd %4, %%edi\n" > - "\tadd %5, %%esi\n" > - "\tadd %6, %%ebx\n" > + "\tadd %5, %%edi\n" > + "\tadd %6, %%esi\n" > + "\tadd %7, %%ebx\n" > > /* > * sample = *src; > @@ -138,15 +146,16 @@ static void MIX_AREAS_16(unsigned int size, > "\tjnz 4b\n" > "\tdecl %0\n" > "\tjnz 1b\n" > - > - "7:" > - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ > > - : /* no output regs */ > - : "m" (size), "m" (dst), "m" (src), > - "m" (sum), "m" (dst_step), "m" (src_step), > - "m" (sum_step), "m" (old_ebx) > - : "esi", "edi", "edx", "ecx", "eax" > + "7:" > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %1, %%ebx\n",) > + > + : "+&rm" (size), GCC_PIC_SWITCH("=m","=X") (old_ebx) > + : "m" (dst), "m" (src), "m" (sum), > + "im" (dst_step), "im" (src_step), "im" (sum_step) > + : "esi", "edi", "edx", "ecx", GCC_PIC_SWITCH(,"ebx"COMMA) "eax", > + "memory", "cc" > ); > } > > @@ -171,22 +180,24 @@ static void MIX_AREAS_16_MMX(unsigned int size, > __asm__ __volatile__ ( > "\n" > > - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %%ebx, %1\n",) > /* > - * initialization, load ESI, EDI, EBX registers > + * initialization, load ESI, EDI, EBX registers, clear MM1 > */ > - "\tmovl %1, %%edi\n" > - "\tmovl %2, %%esi\n" > - "\tmovl %3, %%ebx\n" > + "\tpxor %%mm1, %%mm1\n" > + "\tmovl %2, %%edi\n" > + "\tmovl %3, %%esi\n" > + "\tmovl %4, %%ebx\n" > "\tcmpl $0, %0\n" > "\tjnz 2f\n" > "\tjmp 5f\n" > > "\t.p2align 4,,15\n" > "1:" > - "\tadd %4, %%edi\n" > - "\tadd %5, %%esi\n" > - "\tadd %6, %%ebx\n" > + "\tadd %5, %%edi\n" > + "\tadd %6, %%esi\n" > + "\tadd %7, %%ebx\n" > > "2:" > /* > @@ -230,13 +241,14 @@ static void MIX_AREAS_16_MMX(unsigned int size, > "\tjnz 1b\n" > "\temms\n" > "5:" > - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ > - > - : /* no output regs */ > - : "m" (size), "m" (dst), "m" (src), > - "m" (sum), "m" (dst_step), "m" (src_step), > - "m" (sum_step), "m" (old_ebx) > - : "esi", "edi", "edx", "ecx", "eax" > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %1, %%ebx\n",) > + > + : "+&rm" (size), GCC_PIC_SWITCH("=m","=X") (old_ebx) > + : "m" (dst), "m" (src), "m" (sum), > + "im" (dst_step), "im" (src_step), "im" (sum_step) > + : "esi", "edi", "edx", "ecx", GCC_PIC_SWITCH(,"ebx"COMMA) "eax", > + "mm0", "mm1", "memory", "cc" > ); > } > > @@ -261,13 +273,14 @@ static void MIX_AREAS_32(unsigned int size, > __asm__ __volatile__ ( > "\n" > > - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %%ebx, %1\n",) > /* > * initialization, load ESI, EDI, EBX registers > */ > - "\tmovl %1, %%edi\n" > - "\tmovl %2, %%esi\n" > - "\tmovl %3, %%ebx\n" > + "\tmovl %2, %%edi\n" > + "\tmovl %3, %%esi\n" > + "\tmovl %4, %%ebx\n" > "\tcmpl $0, %0\n" > "\tjnz 1f\n" > "\tjmp 6f\n" > @@ -337,19 +350,20 @@ static void MIX_AREAS_32(unsigned int size, > */ > "\tdecl %0\n" > "\tjz 6f\n" > - "\tadd %4, %%edi\n" > - "\tadd %5, %%esi\n" > - "\tadd %6, %%ebx\n" > + "\tadd %5, %%edi\n" > + "\tadd %6, %%esi\n" > + "\tadd %7, %%ebx\n" > "\tjmp 1b\n" > - > - "6:" > - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ > > - : /* no output regs */ > - : "m" (size), "m" (dst), "m" (src), > - "m" (sum), "m" (dst_step), "m" (src_step), > - "m" (sum_step), "m" (old_ebx) > - : "esi", "edi", "edx", "ecx", "eax" > + "6:" > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %1, %%ebx\n",) > + > + : "+&rm" (size), GCC_PIC_SWITCH("=m","=X") (old_ebx) > + : "m" (dst), "m" (src), "m" (sum), > + "im" (dst_step), "im" (src_step), "im" (sum_step) > + : "esi", "edi", "edx", "ecx", GCC_PIC_SWITCH(,"ebx"COMMA) "eax", > + "memory", "cc" > ); > } > > @@ -374,13 +388,14 @@ static void MIX_AREAS_24(unsigned int size, > __asm__ __volatile__ ( > "\n" > > - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %%ebx, %1\n",) > /* > * initialization, load ESI, EDI, EBX registers > */ > - "\tmovl %1, %%edi\n" > - "\tmovl %2, %%esi\n" > - "\tmovl %3, %%ebx\n" > + "\tmovl %2, %%edi\n" > + "\tmovl %3, %%esi\n" > + "\tmovl %4, %%ebx\n" > "\tcmpl $0, %0\n" > "\tjnz 1f\n" > "\tjmp 6f\n" > @@ -443,19 +458,20 @@ static void MIX_AREAS_24(unsigned int size, > */ > "\tdecl %0\n" > "\tjz 6f\n" > - "\tadd %4, %%edi\n" > - "\tadd %5, %%esi\n" > - "\tadd %6, %%ebx\n" > + "\tadd %5, %%edi\n" > + "\tadd %6, %%esi\n" > + "\tadd %7, %%ebx\n" > "\tjmp 1b\n" > - > - "6:" > - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ > > - : /* no output regs */ > - : "m" (size), "m" (dst), "m" (src), > - "m" (sum), "m" (dst_step), "m" (src_step), > - "m" (sum_step), "m" (old_ebx) > - : "esi", "edi", "edx", "ecx", "eax" > + "6:" > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %1, %%ebx\n",) > + > + : "+&rm" (size), GCC_PIC_SWITCH("=m","=X") (old_ebx) > + : "m" (dst), "m" (src), "m" (sum), > + "im" (dst_step), "im" (src_step), "im" (sum_step) > + : "esi", "edi", "edx", "ecx", GCC_PIC_SWITCH(,"ebx"COMMA) "eax", > + "memory", "cc" > ); > } > > @@ -480,13 +496,14 @@ static void MIX_AREAS_24_CMOV(unsigned int size, > __asm__ __volatile__ ( > "\n" > > - "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %%ebx, %1\n",) > /* > * initialization, load ESI, EDI, EBX registers > */ > - "\tmovl %1, %%edi\n" > - "\tmovl %2, %%esi\n" > - "\tmovl %3, %%ebx\n" > + "\tmovl %2, %%edi\n" > + "\tmovl %3, %%esi\n" > + "\tmovl %4, %%ebx\n" > "\tcmpl $0, %0\n" > "\tjz 6f\n" > > @@ -541,19 +558,20 @@ static void MIX_AREAS_24_CMOV(unsigned int size, > /* > * while (size-- > 0) > */ > - "\tadd %4, %%edi\n" > - "\tadd %5, %%esi\n" > - "\tadd %6, %%ebx\n" > + "\tadd %5, %%edi\n" > + "\tadd %6, %%esi\n" > + "\tadd %7, %%ebx\n" > "\tdecl %0\n" > "\tjnz 1b\n" > - > - "6:" > - "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ > > - : /* no output regs */ > - : "m" (size), "m" (dst), "m" (src), > - "m" (sum), "m" (dst_step), "m" (src_step), > - "m" (sum_step), "m" (old_ebx) > - : "esi", "edi", "edx", "ecx", "eax" > + "6:" > + /* ebx is GOT pointer (-fPIC) */ > + GCC_PIC_SWITCH("\tmovl %1, %%ebx\n",) > + > + : "+&rm" (size), GCC_PIC_SWITCH("=m","=X") (old_ebx) > + : "m" (dst), "m" (src), "m" (sum), > + "im" (dst_step), "im" (src_step), "im" (sum_step) > + : "esi", "edi", "edx", "ecx", GCC_PIC_SWITCH(,"ebx"COMMA) "eax", > + "memory", "cc" > ); > } > -- > 2.17.1 >