home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!dkuug!diku!thorinn
- From: thorinn@diku.dk (Lars Henrik Mathiesen)
- Newsgroups: comp.arch
- Subject: Re: trapping speculative ops (LONG)
- Message-ID: <1992Sep10.180303.27731@odin.diku.dk>
- Date: 10 Sep 92 18:03:03 GMT
- References: <1992Aug31.224611.5196@odin.diku.dk> <1992Sep1.143155.636@bcars64a.bnr.ca> <1992Sep9.121701.13208@odin.diku.dk> <1992Sep10.080446.16268@email.tuwien.ac.at>
- Sender: thorinn@tyr.diku.dk
- Organization: Department of Computer Science, U of Copenhagen
- Lines: 41
-
- anton@mips.complang.tuwien.ac.at (Anton Martin Ertl) writes:
- >thorinn@diku.dk (Lars Henrik Mathiesen) writes:
- >|> [...] currently, compilers have no reason to write the same
- >|> register twice without intervening reads, [...]
-
- >This is true in straight-line code, but generally a write to a
- >register is only redundant if *all* possible execution paths that
- >execute it write to the register another time before reading it.
-
- True --- but I would guess that most such cases have a fair bit of
- code between the writes, and so the write-write stall is too rare to
- concern the hardware architects. But in an exception-bit architecture,
- write-after-write could be almost a paradigm --- speculative
- operations can be issued with the ``true'' destination register, and
- if they turn out to be ``wrong,'' some other valued is loaded into the
- register. Imaginary code for "if (p) p = p->next;":
-
- ; p is in R1
- LD 0(R1),R2 ; start load
- ADD R1,R0,R0 ; test p
- ADD,EQ R1,R0,R2 ; override load if p == 0
- ; p is now in R2!
-
- >|> [...] trap bits on source operands should not [...] trap, but
- >|> should propagate to the result instead.
-
- >[...] how do we know which instruction caused the exception? [...] We
- >check the trap bit of the original trap-noting instruction. This
- >means of course that the compiler has to keep the trap bit alive,
- >which restricts register allocation, if the trap bit is associated
- >with the destination register.
-
- I did not want to clutter up my previous post, but that is exactly
- what I had in mind: If the equivalent of exact traps is wanted, the
- compiler has to keep every speculatively calculated intermediary alive
- until the exception can be taken. This means that the compiler needs/
- can utilize more registers than usual, but we're talking about a new
- architecture anyway, and I get the impression that registers are cheap
- nowadays, or at least not very expensive.
-
- Lars Mathiesen (U of Copenhagen CS Dep) <thorinn@diku.dk> (Humour NOT marked)
-