[comp.arch] Comparison Data

firth@sei.cmu.edu (Robert Firth) (05/07/87)

Postscript to previous post: raw data
gathered from systems code.

Comparison	%

var = 0		18
var >=0		12
var > 0		 0

var = const	31
var >(=)const	18

var = var	19
var > var	 2
var >=var	 1

Each comparison counts both the test and the converse
test, so 'v>0' includes 'v<=0'.  The test 'v>const'
includes all 4 forms, since we can always transform
'v>k' into 'v>=(k-1)'.  Basically 'var' means "anything
not known at compile time"; I didn't check for things like

	IF x > y+1 ...

that can be transformed into IF x>=y.

Gathered from ~12000 lines of BCPL code.  Note two
language-dependent sources of bias

(a) strings have a length count not a NUL terminator,
    so we have 'i<=length' where C would have 'ch=0'

(b) many library calls return a negative error code
    tested for by '<0' comparison

Booleans are represented by (FALSE=>0, TRUE=>allones),
and always tested by treating 0 as FALSE and everything
else as TRUE.

Hope this is informative.