This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Program Bounds Checking
On Thu, Sep 28, 2006 at 12:52:18PM -0400, Tzi-cker Chiueh wrote:
> We have considered the bound instruction in the CASH project. But
> we found that bound instruction is slower than the six normal
> instructions it is meant to replace for range checking. For example, the
> bound instruction on a 1.1 GHz PIII machine requires 7-8 clock cycles
> while the 6 equivalent instructions require 6-7 clock cycles. We have not
> tested it on newer processors, though.
There's also the cache effect, in that larger code will cause more cache
misses. If the penalty for using the shorter code sequence is only one
cycle out of 7, you might still want to support it, or at least if -Os
is specified; large codes might even run faster despite the penalty if
there are fewer cache misses.