From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg McGary To: law@cygnus.com Cc: Geoff Keating , gcc@gcc.gnu.org Subject: Re: Need advice on bounds checking approaches Date: Tue, 28 Mar 2000 09:28:00 -0000 Message-id: References: <9365.954255482@upchuck> X-SW-Source: 2000-03/msg00728.html Jeffrey A Law writes: > Is there any advantage to not always emitting the high/low bounds checks > separately? For i960 there's a small advantage that if you emit checks together, you can use concmp and save one instruction ("cmpo; concmpo; fault" vs. "cmpo; fault; cmpo; fault"). Big deal... For i386, if you check both at once, you can use the `bound' instruction, which is slower, but very compact. In summary, there will be some small space advantage for any target that has special instructions that support bounds checking. For multiple-issue CPUs, the space advantage will come at the expense of runtime, because the checks would likely run faster if they were broken apart to improve scheduling. It should be easy enough to implement each and benchmark to quantify the difference, or even to implement both, and choose at compile time based on the value of `optimize_size'. Greg