Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* MIPS Assembly language question
@ 1995-09-18  4:00 Jeffrey L. Bell
  1995-09-19  4:00 ` Mike Linnig
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey L. Bell @ 1995-09-18  4:00 UTC (permalink / raw)


I'm having trouble getting the assembler to do what I want.
This is on a DEC-5000/240 running Ultrix.

Presently my code looks like this:

	lw t1, x
	lw t2, y
	or t1, t2, t3
	sw t3, z
        ...
	.data
	x: .word 0
	y: .word 0
	z: .word 0

The assembler creates lui instructions for all of the
loads and stores.  This takes up a good 20% of my executable.


I would like to write something like this:

	lw s8, data_origin
	...
	lw t1, data_origin - x (s8)
	lw t2, data_origin - y (s8)
	or t1, t2, t3
	lw t3, data_origin - z (s8)
        ...
.data
	data_origin:
	x: .word 0
	y: .word 0
	z: .word 0

But I can't find any description of what is a legal expression
in Kane and Heinrich

Suggestions?

-Jeff Bell



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: MIPS Assembly language question
  1995-09-18  4:00 MIPS Assembly language question Jeffrey L. Bell
@ 1995-09-19  4:00 ` Mike Linnig
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Linnig @ 1995-09-19  4:00 UTC (permalink / raw)


In article <43ko7h$ff0@news.eecs.umich.edu> jlbell@presto.eecs.umich.edu (Jeffrey L. Bell) writes:

> 
> Presently my code looks like this:
> 
> 	lw t1, x
> 	lw t2, y
> 	or t1, t2, t3
> 	sw t3, z
>         ...
> 	.data
> 	x: .word 0
> 	y: .word 0
> 	z: .word 0
> 
> The assembler creates lui instructions for all of the
> loads and stores.  This takes up a good 20% of my executable.
> 


How about using the la instruction to load the base address and using
.struct to create the offsets:


	la s8, data_origin      # load address of data_origin
	...
	lw t1, x(s8)
	lw t2, y(s8)
	or t1, t2, t3
	lw t3, z (s8)
        ...
.data

data_origin:
        .word 0 # x             -- this is the actual storage
        .word 0 # y
        .word 0 # z

.struct	0
	x: .word 0              -- this provides the offsets
	y: .word 0
	z: .word 0




--

   -- Mike


+-----------------------------------------+
| Mike Linnig                             |
| Phone: 214-575-4308                     |
| "97.43% of all statistics are made up"  |
+-----------------------------------------+



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-09-19  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-09-18  4:00 MIPS Assembly language question Jeffrey L. Bell
1995-09-19  4:00 ` Mike Linnig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox