[Ffmpeg-devel] [PATCH] '/nop' illegal for old versions of GAS

Nigel Pearson nigel
Fri Aug 4 03:42:09 CEST 2006


>> 	nop is is not a numeric expression, but to be
>> perfect, the line should be something like " # nop"?
>> Sadly, that requires re-writing of the macros.
>
> if you do that, use #define NOP " # nop" and then use NOP

	I wish I could. That results in:

"pmaddwd %%mm6, %%mm1           \n\t"      # " # nop   " ", %%mm4       
         \n\t"        "movq %%mm4, %%mm6              \n\t"         
"movq 48(%2), %%mm7             \n\t"         # " # nop   " ", %%mm0    
            \n\t"

	which gas complains:

{standard input}:410:invalid character ',' in opcode






	Sadly, the values are passed into another macro,
and I have now been able to get CPP to expand beforehand.
So, this:

#define NOP "nop"
#define IDCT(a,b,c) \
	"movq " #a ", " #c "    \n\t"\
	#b "," #c
IDCT(zot,NOP,fubar)

	expands to:

"zot,fubar       \n\t"          #NOP ",fubar"



	The only way I have gotten it to actually
put whitespace before a nop is this ugliness:

IDCT(zot, \040#\040nop, fubar)

	which gives:

"zot,fubar       \n\t"

--
Nigel Pearson, nigel at ind.tansu.com.au| "Peacemaking is our profession"
Telstra Net. Eng., Sydney, Australia |Motto of Burpelson Airforce Base
Office: 9202 3900    Fax:  9261 3912 |Commanded by Gen. Jack D. Ripper
Mobile: 0408 664435  Home: 9792 6998 |        Dr Strangelove




>> 	nop is is not a numeric expression, but to be
>> perfect, the line should be something like " # nop"?
>> Sadly, that requires re-writing of the macros.
>
> if you do that, use #define NOP " # nop" and then use NOP

	I wish I could. On an Intel Mac, that results in:

"pmaddwd %%mm6, %%mm1           \n\t"      # " # nop   " ", %%mm4       
         \n\t"        "movq %%mm4, %%mm6              \n\t"         
"movq 48(%2), %%mm7             \n\t"         # " # nop   " ", %%mm0    
            \n\t"

	and on a Linux GCC 3.3.5 toolset, it does:

"pmaddwd %%mm6, %%mm1           \n\t" "NOP" ", %%mm4               \n\t"
"movq %%mm4, %%mm6              \n\t" "movq 48(%2), %%mm7             
\n\t"
"NOP" ", %%mm0               \n\t"

	Either way, gas doesn't like it:

{standard input}:410:invalid character ',' in opcode
	or
/tmp/ccjWdbJ8.s: Assembler messages:
/tmp/ccjWdbJ8.s:460: Error: invalid character ',' in mnemonic



	I have spent a lot of time testing various combinations.
The different cpp versions give very different expansions.
This usage, where we are hoping cpp will expand one macro
which is the argument of another one,
will probably always be "implementation dependent?"



	The original patch, which replaced /nop with #nop,
expands to this on both Linux GCC 3.3.5, and the Intel
Mac's GCC 4.0.1/GAS 1.3.8:

"pmaddwd %%mm6, %%mm1           \n\t" "#nop" ", %%mm4               
\n\t"
"movq %%mm4, %%mm6              \n\t" "movq 48(%2), %%mm7             
\n\t"
"#nop" ", %%mm0               \n\t"

which I think is legal asm comment in two ways:
1) The line starts with whitespace (\t)
2) The symbol after the comment (#) is non-numeric,
    so it will not be interpreted as a line jump




	Can we have that one committed? Please?

--
Nigel Pearson, nigel at ind.tansu.com.au| "Peacemaking is our profession"
Telstra Net. Eng., Sydney, Australia |Motto of Burpelson Airforce Base
Office: 9202 3900    Fax:  9261 3912 |Commanded by Gen. Jack D. Ripper
Mobile: 0408 664435  Home: 9792 6998 |        Dr Strangelove




More information about the ffmpeg-devel mailing list