Received: (from major@localhost)
	by minnie.cs.adfa.oz.au (8.8.5/8.8.5) id NAA02467
	for pups-liszt; Wed, 15 Apr 1998 13:09:51 +1000 (EST)
X-Authentication-Warning: minnie.cs.adfa.oz.au: major set sender to owner-pups@minnie.cs.adfa.oz.au using -f
Received: from renoir.op.net (root@renoir.op.net [209.152.193.4])
	by minnie.cs.adfa.oz.au (8.8.5/8.8.5) with ESMTP id NAA02451
	for <pups@minnie.cs.adfa.oz.au>; Wed, 15 Apr 1998 13:09:41 +1000 (EST)
Received: from goppelt.op.net (d-phlarc1-00.ppp.op.net [209.152.199.64]) by renoir.op.net (o1/$Revision: 1.16 $) with SMTP id XAA00270; Tue, 14 Apr 1998 23:09:28 -0400 (EDT)
Message-Id: <199804150309.XAA00270@renoir.op.net>
Comments: Authenticated sender is <edgee@cyberpass.net>
From: "Ed G." <edgee@cyberpass.net>
To: pete@dunnington.u-net.com (Pete Turnbull)
Date: Tue, 14 Apr 1998 23:09:26 -0400
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: Re: Floating Point-How Important
Reply-to: edgee@cyberpass.net
CC: pups@minnie.cs.adfa.oz.au
In-reply-to: <9804111346.ZM7828@indy.dunnington.york.ac.uk>
References: "Ed G." <edgee@cyberpass.net>        "Re: Floating Point-How Important to Unix?" (Apr 10, 22:40)
X-mailer: Pegasus Mail for Win32 (v2.54)
Sender: owner-pups@minnie.cs.adfa.oz.au
Precedence: bulk

> What about position-independent code?

Your query got me thinking about the various addressing modes 
of the PDP-11 and how they might affect my brute force approach to 
estimating floating point ops for C programs.  Is this what you meant 
when you asked about position independent code?

And yes, these addressing modes could mean the death knell for my 
approach.

Index mode is definitely a problem as C programs seem to use r5 as a
frame pointer with both positive and *negative* 16 bit offsets (see
assembly language listing of my square root program below).

I don't think PC relative mode (e.g., clr addr) is a problem 
(if the data segment follows the text, then the offsets would all be 
positive and all less than the size of the program).

Is there such a thing as PC relative mode for the jmp op 
code?  In other words, can you make long + or -32K relative jumps on 
the PDP-11? If so, this too could potentially confound my estimates.

.globl	_absv
.text
_absv:
~~absv:
jsr	r5,csv
~n=4
jbr	L1
L2:clrf	r0
cmpf	4(r5),r0
cfcc
jge	L4
movf	4(r5),r0
negf	r0
jbr	L3
jbr	L5
L4:movf	4(r5),r0
jbr	L3
L5:L3:jmp	cret
L1:jbr	L2
.globl	_mysqrt
.text
_mysqrt:
~~mysqrt:
jsr	r5,csv
~n=4
jbr	L6
L7:~g=177762
~err=177752
movf	4(r5),r0
divf	$40400,r0
movf	r0,-16(r5)
.data
L10000:77777;177776;177777;177777
.text
movf	4(r5),r0
divf	L10000,r0
movf	r0,-26(r5)
movf	-16(r5),r0
movf	r0,-(sp)
mov	$L9,-(sp)
jsr	pc,_printf
add	$12,sp
L10:movf	-16(r5),r0
mulf	-16(r5),r0
subf	4(r5),r0
movf	r0,-(sp)
jsr	pc,_absv
add	$10,sp
cmpf	-26(r5),r0
cfcc
jgt	L11
movf	-16(r5),r0
mulf	-16(r5),r0
addf	4(r5),r0
movf	$40400,r1
mulf	-16(r5),r1
divf	r1,r0
movf	r0,-16(r5)
movf	-16(r5),r0
movf	r0,-(sp)
mov	$L12,-(sp)
jsr	pc,_printf
add	$12,sp
jbr	L10
L11:movf	-16(r5),r0
jbr	L8
L8:jmp	cret
L6:sub	$20,sp
jbr	L7
.globl	_main
.text
_main:
~~main:
jsr	r5,csv
jbr	L13
L14:.data
L10001:77777;177776;177777;177777
.text
movf	L10001,r0
movf	r0,-16(r5)
~n=177762
movf	-16(r5),r0
movf	r0,-(sp)
jsr	pc,_mysqrt
add	$10,sp
movf	r0,-(sp)
mov	$L16,-(sp)
jsr	pc,_printf
add	$12,sp
L15:jmp	cret
L13:sub	$10,sp
jbr	L14
.globl	fltused
.globl
.data
L9:.byte 111,156,151,164,151,141,154,40,147,165,145,163,163,72
.byte 40,45,56,61,66,146,12,12,0
L12:.byte 147,165,145,163,163,72,40,45,56,61,66,146,12,0
L16:.byte 12,115,171,40,163,161,165,141,162,145,40,162,157,157
.byte 164,40,151,163,72,40,45,56,61,66,146,12,0

