GDC review process.

Iain Buclaw ibuclaw at ubuntu.com
Wed Jun 20 02:56:23 PDT 2012


On 20 June 2012 09:32, Tobias Pankrath <tobias at pankrath.net> wrote:
>> Inline assembly has been relatively useless in GCC for years. Inline asm
>> interferes with the optimisers ability to do a good job, which basically
>> makes use of inline assembly self-defeating.
>> The only time I ever need to use inline-asm is to interface an arch
>> feature
>> that has no API. As long as there are intrinsics for all the opcodes one
>> might want, then it's better to use them.
>
>
>> That said, as stated above, if use of this stuff is for performance, then
>> using an inline-asm block will ruin the surrounding code anyway,
>
>
> Could someone explain to me, why inline asm screws up the optimizer? My
> naive view on the matter is, that the optimizer has full knowledge of what
> is going on regardless of whether intrinsics or asm is used. I could also
> think of an optimizer that optimizes inline asm, too. For example by
> reassigning registers etc.
>
>

Actually, the compiler has little knowledge of what the assembly does
at all, other than the input/output constraints, and what gets
registers get clobbered.  Which is enough for the compiler to know how
to avoid stepping on your toes when trying to work around it.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list