[Info-vax] Volatile, was: Re: yet another sys$qiow question

Simon Clubley clubley at remove_me.eisner.decus.org-Earth.UFP
Thu Aug 20 09:03:34 EDT 2015


On 2015-08-20, Simon Clubley <clubley at remove_me.eisner.decus.org-Earth.UFP> wrote:
> On 2015-08-19, VAXman-  @SendSpamHere.ORG <VAXman- at SendSpamHere.ORG> wrote:
>>
>>     sp = (void *)asm("bis %r29,%r31,%r0;");	// get FP address                        
>
> It doesn't apply here because you are using the output from the asm()
> insert, but if you use an asm() insert in gcc that doesn't have any
> obvious side effects, then the gcc optimiser can remove the asm insert.
>

BTW, that's obvious side effects as seen from the compiler such as the
output from the asm insert being assigned to a variable. AFAIK, gcc
doesn't try analysing the opcodes themselves.

> You have to tell gcc what the side effects of the asm insert are so
> the optimiser doesn't do something you don't want it to do. I generally
> mark the asm statement as volatile and tell gcc it clobbers memory.
>
> I mention this because I don't know what LLVM will do here.
>

Simon.

-- 
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world



More information about the Info-vax mailing list