Chapter 25. M32R Dependent Features
147
 Wuh
This is a shorter synonym for the  warn unmatched high option.
 Wnuh
This is a shorter synonym for the  no warn unmatched high option.
25.2. M32R Directives
The Renease M32R version of
as
has a few architecture specific directives:
low expression
The
low
directive computes the value of its expression and places the lower 16 bits of the result
into the immediate field of the instruction. For example:
or3
r0, r0, #low(0x12345678) ; compute r0 = r0 | 0x5678
add3, r0, r0, #low(fred)
; compute r0 = r0 + low 16 bits of address of fred
high expression
The
high
directive computes the value of its expression and places the upper 16 bits of the result
into the immediate field of the instruction. For example:
seth
r0, #high(0x12345678) ; compute r0 = 0x12340000
seth, r0, #high(fred)
; compute r0 = upper 16 bits of address of fred
shigh expression
The
shigh
directive is very similar to the
high
directive. It also computes the value of its ex 
pression and places the upper 16 bits of the result into the immediate field of the instruction. The
difference is that
shigh
also checks to see if the lower 16 bits could be interpreted as a signed
number, and if so it assumes that a borrow will occur from the upper 16 bits. To compensate for
this the
shigh
directive pre biases the upper 16 bit value by adding one to it. For example:
For example:
seth
r0, #shigh(0x12345678) ; compute r0 = 0x12340000
seth
r0, #shigh(0x00008000) ; compute r0 = 0x00010000
In the second example the lower 16 bits are 0x8000. If these are treated as a signed value and sign
extended to 32 bits then the value becomes 0xffff8000. If this value is then added to 0x00010000
then the result is 0x00008000.
This behaviour is to allow for the different semantics of the
or3
and
add3
instructions. The
or3
instruction treats its 16 bit immediate argument as unsigned whereas the
add3
treats its 16 bit
immediate as a signed value. So for example:
seth
r0, #shigh(0x00008000)
add3
r0, r0, #low(0x00008000)
Produces the correct result in r0, whereas:
seth
r0, #shigh(0x00008000)
or3
r0, r0, #low(0x00008000)
Stores 0xffff8000 into r0.
Note   the
shigh
directive does not know where in the assembly source code the lower 16 bits
of the value are going set, so it cannot check to make sure that an
or3
instruction is being used
rather than an
add3
instruction. It is up to the programmer to make sure that correct directives
are used.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

canadian web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved