Sujet : Re: Stack vs stackless operation
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 28. Feb 2025, 22:55:05
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Feb28.225505@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5
User-Agent : xrn 10.11
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
Another variant:
>
: exchange ( addr1 addr2 -- )
dup @ rot !@ swap ! ;
>
This uses the primitive
>
'!@' ( u1 a-addr -- u2 ) gforth-experimental "store-fetch"
load U2 from A_ADDR, and store U1 there, as atomic operation
>
I worry that the atomic part will result in it being slower than the
versions that do not use !@.
It's barely noticable on Zen4, but it makes a big difference on the
Cortex-A55. Therefore we decided to also have a nonatomic !@. We renamed the atomic one into ATOMIC!@ and !@ is now the nonatomic version.
How do they perform?
On Zen4:
!@ atomic!@
821_538_216 880_459_702 cycles
3_815_202_629 3_710_937_849 instructions
On Cortex-A55:
!@ atomic!@
3355427045 5856496676 cycles
3115589778 4318749543 instructions
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/EuroForth 2023 proceedings: http://www.euroforth.org/ef23/papers/EuroForth 2024 proceedings:
http://www.euroforth.org/ef24/papers/