Author: Dieter Buerssner
Date: 13:44:38 02/19/04
Go up one level in this thread
On February 19, 2004 at 16:16:23, Robert Hyatt wrote: >I looked at my old inline asm docs, and I found the following statement, >paraphrased: > >"you don't need to put gcc-allocated registers on the clobber list, it knows you >are fooling with them." That's news to me. I cannot find it in my gcc manual (and I know, that it did not work with earlier gcc versions). Some snippets of my gcc manual: --- The compiler cannot check whether the operands have data types that are reasonable for the instruction being executed. It does not parse the assembler instruction template and does not know what it means or even whether it is valid assembler input. [...] Some instructions clobber specific hard registers. To describe this, write a third colon after the input operands, followed by the names of the clobbered hard registers (given as strings). [...] You may not write a clobber description in a way that overlaps with an input or output operand. For example, you may not have an operand describing a register class with one member if you mention that register in the clobber list. There is no way for you to specify that an input operand is modified without also specifying it as an output operand. Note that if all the output operands you specify are for this purpose (and hence unused), you will then also need to specify `volatile' for the `asm' construct, as described below, to prevent GCC from deleting the `asm' statement as unused. --- To me it looks, as you really have to tell to gcc exactly, which operands to the asm are modified. This indeed makes it not really easy, to write correct inline assembly for gcc. I had one project for "big numbers", which I had coded with inline assembly in gcc (over a factor of 10 faster, than the C code - mainly because one cannot access the carry from C, and the 32*32->64 bit mul, similar for div). At that time, gcc allowed to put input operands into the clobber list. Then they changed that, and all the asm had to be modified. It was a lot of work. There was no option for backwards compability - the code just broke from one version to the other (it was correct according to the older documentation, the feature was not deprecated at all, there were even examples in the manual, that showed the later not allowed input regs in the clobber list). Regards, Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.