Hi everyone,
So this is another question on peephole optimisation for x86_64.
Occasionally you get situations where you write a load of constants to
the stack - in this case it's part of an array parameter to a function call:
movl $23199763,32(%rsp)
movl $262149,36(%rsp)
mov
At least for me, I think most programmers know not to use FillChar to
fill a managed type, but it is a good point to be careful.
Zeroing a register and moving it into a block is usually the fastest way
to go about such things, but FillChar doesn't assume the input is zero,
whereas if it were t
I would rather give a hint to change the code - because only for unmanaged
types the semantic of FillChar is equal to default().
As for performance - I just ran some benchmarks comparing the way FPC does it
and how Delphi does it. xor a register and mov that into place (Delphi way) is
faster in
Interesting - I wasn't aware of this intrinsic! I'll make a note of
that one.
It might be useful to transform FillChar calls to the Default intrinsic
at the node level.
Gareth aka. Kit
On 19/04/2022 12:43, Stefan Glienke via fpc-devel wrote:
You are the expert but I am not sure how that ca
You are the expert but I am not sure how that can be the case given you only
need to zero a register and blast that into the record location opposed to
twice as many mov operations being generated that I have seen with the record
that Gareth originally posted.
> On 19/04/2022 13:37 Sven Barth v
Stefan Glienke via fpc-devel schrieb am
Di., 19. Apr. 2022, 12:38:
> If you want to zero small records more efficiently it might be better
> using Default(t) for that and looking at optimizing the code the compiler
> generates for that as it seems it produces an empty temp variable which it
> ass
If you want to zero small records more efficiently it might be better using
Default(t) for that and looking at optimizing the code the compiler generates
for that as it seems it produces an empty temp variable which it assigns
instead of simply zeroing the record variable where default() is bein