Need advice on bounds checking approaches
Greg McGary
gkm@eng.ascend.com
Tue Mar 28 09:28:00 GMT 2000
Jeffrey A Law <law@cygnus.com> 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
More information about the Gcc
mailing list