[fpc-devel] Successful implementation of inline support forpure assembler routines on x86
Florian Klämpfl
florian at freepascal.org
Sun Mar 17 20:02:23 CET 2019
Am 17.03.19 um 18:18 schrieb J. Gareth Moreton:
> Hi Florian,
>
> I think the main thing is that Object
> Pascal has always supported the ability to
> drop into assembly language, unlike C++
> which requires a dialect-specific
> extension and is not allowed at all under
> Microsoft Visual C++ 64-bit.
Actually, the policy of FPC is to avoid assembler as much as possible.
> Allowing
> certain assembler routines to be inlined
> seems like a logical extension using
> language semantics that already exist.
>
> Part of it may be preference but I think
> some people like the fine degree of
> control that assembly language offers,
> while intrinsics > I find, can quickly get
> somewhat untidy and confusing,
I cannot see how inlining does this better?
> especially
> with instructions like CPUID that read and
> write to specific registers (although my
> code forbids that instruction because EBX
> is non-volatile).
CPUID is that slow, it makes no sense to inline it.
>
> The other thing... no matter how good the
> compiler is, there are some situations
> where assembly language will always
> perform better.
I doubt this as inline assembler pure routines use always fixed
registers. Intrinsics don't do so.
>
> I suppose I would like to ask the
> community more than anything. Is this a
> feature that you'd like to see and use?
>
> I hoped the way that I designed the patch
> helps to alleviate the can of worms by
> simply not allowing inline if the platform
> doesn't have the ability to support it
> yet.
But this is exactly the can of worms. People will request that we
support it on all CPUs.
> "CanInline" simply returns False
> unless overridden.
>
More information about the fpc-devel
mailing list