This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] [powerpc] add 'volatile' to asm
On 6/12/19 1:55 PM, Florian Weimer wrote:
> * Paul A. Clarke:
>> diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
>> index f8dd1b7..f66bf24 100644
>> --- a/sysdeps/powerpc/fpu/fenv_libc.h
>> +++ b/sysdeps/powerpc/fpu/fenv_libc.h
>> @@ -56,9 +56,9 @@ extern const fenv_t *__fe_mask_env (void) attribute_hidden;
>> #define relax_fenv_state() \
>> do { \
>> if (GLRO(dl_hwcap) & PPC_FEATURE_HAS_DFP) \
>> - asm (".machine push; .machine \"power6\"; " \
>> + asm volatile (".machine push; .machine \"power6\"; " \
>> "mtfsfi 7,0,1; .machine pop"); \
>> - asm ("mtfsfi 7,0"); \
>> + asm volatile ("mtfsfi 7,0"); \
>> } while(0)
>
> I think this change is a no-op because asm statements without inputs and
> outputs (“Basic Asm”) are implicitly volatile. Are you adding these
> just for consistency?
Of course that's what I was doing! ;-)
Actually, no. What I was doing was making assumptions based on an incomplete understanding of the semantics to which you refer, but I like your explanation better.
I'm tempted to push those changes anyway, as I think there is less chance for confusion (like mine), unless there are objections.
PC