Article View: comp.arch
Article #569Re: Register windows
From: Anton Ertl
Date: Sat, 07 Nov 2026 18:01
Date: Sat, 07 Nov 2026 18:01
44 lines
3534 bytes
3534 bytes
antispam@fricas.org (Waldek Hebisch) writes: >Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote: >> In a modern >> (post-1995, with a few exceptions, most of which have died out in the >> meantime) processor the front end predicts the return from the >> processor-internal return stack and often starts fetching from there >> before the load-store unit sees the load of the return address. The >> return address is then used to validate the branch prediction and >> retire the return instruction. > >It must be more complex. Silly fibonacci benchmark shows average >performance of function call per 2 clocks. Without inlining? On what hardware? What I see on a Rocket Lake with a Fibonacci program compiled by the Rust 1.89 compiler is 3.6 cycles per return (i.e., also per call, with 2.3 branches per return). I have not looked at the code to see if there is any inlining, but given that a regular fibonacci call includes a call, a conditional branch, and a return (with any recursive call accounted separately), showing 2.3 branches indicates that there is at least some inlining going on here. >Given length of >the pipeline return address is pushed too late to use it for >fetching intructions after return. In other words, return >must be predicted before the call starts executing. Certainly. Modern branch predictors have to trigger on addresses, not on the results of fetches. But if a microarchitecture really does a non-inlined fibonacci program at two cycles per call, even more prediction has to be done: In the base case (half of the calls) the push to the return address stack is followed by a pull from the return address stack, and all of that and the prediction based on the return address must happen in two cycles. Or maybe there is some special fast path for such cases. What the microarchitects do in the branch predictors is certainly amazing. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID:
<2026Nov7.190141@mips.complang.tuwien.ac.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<vpufbv$4qc5$1@dont-email.me> <1792870082-5857@newsgrouper.org> <11bj58a$327li$1@dont-email.me> <2026Oct26.193309@mips.complang.tuwien.ac.at> <11bob96$3af$2@gal.iecc.com> <11bpggu$1961c$1@dont-email.me> <1793120292-5857@newsgrouper.org> <2026Oct29.171118@mips.complang.tuwien.ac.at> <1793296454-5857@newsgrouper.org> <2026Oct29.190945@mips.complang.tuwien.ac.at> <11cnj5a$36etq$1@paganini.bofh.team>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: Re: Register windows Date: Sat, 07 Nov 2026 18:01:41 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 44 Message-ID: <2026Nov7.190141@mips.complang.tuwien.ac.at> References: <vpufbv$4qc5$1@dont-email.me> <1792870082-5857@newsgrouper.org> <11bj58a$327li$1@dont-email.me> <2026Oct26.193309@mips.complang.tuwien.ac.at> <11bob96$3af$2@gal.iecc.com> <11bpggu$1961c$1@dont-email.me> <1793120292-5857@newsgrouper.org> <2026Oct29.171118@mips.complang.tuwien.ac.at> <1793296454-5857@newsgrouper.org> <2026Oct29.190945@mips.complang.tuwien.ac.at> <11cnj5a$36etq$1@paganini.bofh.team> Injection-Date: Sat, 07 Nov 2026 18:22:38 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3830361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19S3BAuXVXG4cMON37SYxcd"; posting-host="311f2d42f8002bf9ed9618beacf20f3c" Cancel-Lock: sha1:reHiWjsKzFHHPZhCwiayt2WjrnI= sha256:XydN7sj+GkOupzHRH4PXEgi6HTXd5l3dkvTxJwpBMC8= sha1:E1BMukWLum1zblnT3gYLkWDohsc= sha256:fq2jdDYqpvHhCi3HgxvWyJ+yqVnlkUyJa54/xDPPTV0= X-newsreader: xrn 10.11