From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,4820dfa6cb2bff3e X-Google-Attributes: gid102b75,public X-Google-Thread: 111c93,3626ccca6bb70e55 X-Google-Attributes: gid111c93,public From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Subject: Re: 21264 performance anomalies Date: 1999/04/14 Message-ID: <7f232u$fvc$1@news.tuwien.ac.at>#1/1 X-Deja-AN: 466276859 References: <87d81hkqw0.fsf@pfaffben.user.msu.edu> <7ei0gg$1kg$1@news.tuwien.ac.at> <370CF898.BD85182@moene.indiv.nluug.nl> <7ej80q$o1a$1@news.tuwien.ac.at> <7eqq1b$3nr$1@localhost.best.com> <7etets$kel@usenet.pa.dec.com> Organization: Institut fuer Computersprachen, Technische Universitaet Wien Newsgroups: comp.os.linux.alpha,comp.arch In article <7etets$kel@usenet.pa.dec.com>, Justin Carlson writes: > In comp.arch Donald C. Lindsay wrote: [Donald Lindsay had a theory about the extra penalty I saw, when a non-nop was in front of the unaligned jump target; I am not sure whether Justin Carlson addresses this or also the original penalty I saw for jump target misalignment]. > This is close, but not quite correct. I don't have the description in > front of me, but I believe the penalty you are seeing is due to the > fact that only 1 predicted index-set target is kept per fetch block > (16 bytes). This the fetch blocks with multiple jumps will only > keep history for one of those jumps, not all of them. > > Keeping 11 bits of index-set prediction data per fetch block already > eats up a fair bit of space; Keeping 44 bits would probably be extreme > overkill. > > At any rate, I'm guessing you'll see the penalty go away not if > you align the jumps or the targets, but rather if you insure that > multiple jumps don't exist in the same fetch block. > > Make sense? It would, if there was more than one jump in the 16-byte block. Ok, maybe the chip does not fully decode the instructions for this, but decoding a frequent instruction like ldah or addq (which is what I used) as jump would probably seriously hurt branch prediction. One theory I have is that the performance penalty exists as soon as the destination register of the instruction before the unaligned branch target is not $31 (the zero register). I made a few experiments, and they seem to support this (but I also found a few more unexpected variations). I also made several experiments with the same code in the 16-byte block, varying the branch target between the first and the second instruction of the block, and always saw a huge slowdown when the jump target was not the first instruction. - anton -- M. Anton Ertl Some things have to be seen to be believed anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen http://www.complang.tuwien.ac.at/anton/home.html