Re: Inline assembly without inputs considered const/pure?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/25/2016 04:40 PM, Andrew Haley wrote:
> On 02/25/2016 03:36 PM, Matthias Pfaller wrote:
>> When gcc decides to inline mrsbasepri it will again be free to CSE the
>> mrs instructions :-(. Is it really just me having run into this problem?
>> How do other people solve the problem that __asm__ without input is
>> handled like a __attribute((const)) function?
> 
> Either with a memoryclobber, or make it volatile, or both.

I have a memoryclobber, but that's output and doesn't help for input.
And marking it volatile will avoid deleting it in all cases. But I want
to get it deleted when I don't need the return value. Its just getting
deleted by CSE I want to avoid. That's because I sometimes need

	dfi();
	... some code ...
	efi();

and sometimes I'd like to do

	sr = dfi();
	... some code ...
	rfi(sr);

In the first case I'd like gcc to delete the "mrs Rx,basepri". In the
second case I need it. Usually that works quite well, but when you do
multiple

	sr = dfi();
	...
	rfi(sr)

sequences in a function, gcc will CSE the later mrs opcodes. With the
__COUNTER__ trick I can avoid that. But when you are using this in
functions that get inlined you're off where you started...

regards, Matthias
-- 
Matthias Pfaller                          Software Entwicklung
marco Systemanalyse und Entwicklung GmbH  Tel   +49 8131 5161 41
Hans-Böckler-Str. 2, D 85221 Dachau       Fax   +49 8131 5161 66
http://www.marco.de/                      Email leo@xxxxxxxx
Geschäftsführer Martin Reuter             HRB 171775 Amtsgericht München



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux