Re: [RFC PATCH] x86/hweight: Get rid of the special calling convention

From: Denys Vlasenko
Date: Thu May 05 2016 - 09:02:45 EST


On 05/04/2016 10:22 PM, Borislav Petkov wrote:
> On Wed, May 04, 2016 at 12:49:17PM -0700, H. Peter Anvin wrote:
>> Sigh. Doesn't look like -Wa is going to help due to the lack of the
>> equivalent of an -include option in gas.
>
> So much for the register "freedom" - I'll resurrect the hardcoded insn
> bytes. :-\
>
> Unless my gcc friends have some other ideas...
>
> sarge:~# gcc --version
> gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
> Copyright (C) 2003 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> sarge:~# cat popcnt.c
> int main(void)
> {
> int a, b;
>
> asm volatile("popcnt %0, %1" : "=r" (a) : "r" (b));
>
> return 0;
> }
> sarge:~# gcc -Wall -o popcnt{,.c}
> /tmp/ccHmmgjH.s: Assembler messages:
> /tmp/ccHmmgjH.s:14: Error: no such instruction: `popcnt %eax,%eax'
> sarge:~#

You are looking at the version of a wrong program.
gcc doesn't process assembly, it generates it.
as is part of binutils, not gcc. "as --version".