Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: Stack vs stackless operation Date: Fri, 28 Feb 2025 21:55:05 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 37 Message-ID: <2025Feb28.225505@mips.complang.tuwien.ac.at> References: <591e7bf58ebb1f90bd34fba20c730b83@www.novabbs.com> <34df278ef0a52d0eab9d035f45795389@www.novabbs.com> <2025Feb26.153250@mips.complang.tuwien.ac.at> <2025Feb26.184613@mips.complang.tuwien.ac.at> Injection-Date: Fri, 28 Feb 2025 23:08:40 +0100 (CET) Injection-Info: dont-email.me; posting-host="e054b86fdabb721dc5ec61dd1f9ee2c7"; logging-data="4049966"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Cgj9xKd9tc19nuA3tulyM" Cancel-Lock: sha1:+tDGAt8B2no0Y5o4dR75I34TGjs= X-newsreader: xrn 10.11 Bytes: 2450 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.html comp.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/