Floating Point-How Important

Ed G. edgee at cyberpass.net
Wed Apr 15 13:09:26 AEST 1998


> 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

Received: (from major at localhost)
	by minnie.cs.adfa.oz.au (8.8.5/8.8.5) id NAA02612
	for pups-liszt; Wed, 15 Apr 1998 13:54:11 +1000 (EST)
X-Authentication-Warning: minnie.cs.adfa.oz.au: major set sender to owner-pups at minnie.cs.adfa.oz.au using -f


More information about the TUHS mailing list