On 10/18/17 13:30, Segher Boessenkool wrote:
> On Wed, Oct 18, 2017 at 11:10:48AM +0000, Bernd Edlinger wrote:
>> A memory clobber would also make rtx_moveable_p return false,
>> thru the following case:
>>
>>      case MEM:
>>        if (type == OP_IN && MEM_READONLY_P (x))
>>          return rtx_moveable_p (&XEXP (x, 0), OP_IN);
>>        return false;
>>
>> ...
>>
>>      case CLOBBER:
>>        return rtx_moveable_p (&SET_DEST (x), OP_OUT);
>>
>>
>> because that memory clobber is in a parallel statement
>> together with the ASM_OUTPUT.
>>
>> Right?
> 
> Yes, that looks correct.  And a memory clobber of course _should_ make
> the insn non-moveable as well -- it's an unknown side effect all by
> itself :-)
> 
> 

Yeah, that's probably not what they wanted to hear,
but supposed this is the only place where the volatility
of ASM_OUTPUT is ignored, then adding a memory clobber
to the asm stmt is the way to go if they want to play
safe, especially when implementing spin-locks.


Bernd.

Reply via email to