| <html lang="en"> |
| <head> |
| <title>M32R-Directives - Using as</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Using as"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="M32R_002dDependent.html#M32R_002dDependent" title="M32R-Dependent"> |
| <link rel="prev" href="M32R_002dOpts.html#M32R_002dOpts" title="M32R-Opts"> |
| <link rel="next" href="M32R_002dWarnings.html#M32R_002dWarnings" title="M32R-Warnings"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU Assembler "as". |
| |
| Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 |
| or any later version published by the Free Software Foundation; |
| with no Invariant Sections, with no Front-Cover Texts, and with no |
| Back-Cover Texts. A copy of the license is included in the |
| section entitled ``GNU Free Documentation License''. |
| |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| <link rel="stylesheet" type="text/css" href="../cs.css"> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="M32R-Directives"></a> |
| <a name="M32R_002dDirectives"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="M32R_002dWarnings.html#M32R_002dWarnings">M32R-Warnings</a>, |
| Previous: <a rel="previous" accesskey="p" href="M32R_002dOpts.html#M32R_002dOpts">M32R-Opts</a>, |
| Up: <a rel="up" accesskey="u" href="M32R_002dDependent.html#M32R_002dDependent">M32R-Dependent</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">9.20.2 M32R Directives</h4> |
| |
| <p><a name="index-directives_002c-M32R-1127"></a><a name="index-M32R-directives-1128"></a> |
| The Renease M32R version of <code>as</code> has a few architecture |
| specific directives: |
| |
| |
| <a name="index-g_t_0040code_007blow_007d-directive_002c-M32R-1129"></a> |
| <dl><dt><code>low </code><var>expression</var><dd>The <code>low</code> 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: |
| |
| <pre class="smallexample"> or3 r0, r0, #low(0x12345678) ; compute r0 = r0 | 0x5678 |
| add3, r0, r0, #low(fred) ; compute r0 = r0 + low 16-bits of address of fred |
| </pre> |
| <br><dt><code>high </code><var>expression</var><dd><a name="index-g_t_0040code_007bhigh_007d-directive_002c-M32R-1130"></a>The <code>high</code> 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: |
| |
| <pre class="smallexample"> seth r0, #high(0x12345678) ; compute r0 = 0x12340000 |
| seth, r0, #high(fred) ; compute r0 = upper 16-bits of address of fred |
| </pre> |
| <br><dt><code>shigh </code><var>expression</var><dd><a name="index-g_t_0040code_007bshigh_007d-directive_002c-M32R-1131"></a>The <code>shigh</code> directive is very similar to the <code>high</code> |
| directive. It also computes the value of its expression and places |
| the upper 16-bits of the result into the immediate-field of the |
| instruction. The difference is that <code>shigh</code> 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 <code>shigh</code> directive pre-biases the upper |
| 16 bit value by adding one to it. For example: |
| |
| <p>For example: |
| |
| <pre class="smallexample"> seth r0, #shigh(0x12345678) ; compute r0 = 0x12340000 |
| seth r0, #shigh(0x00008000) ; compute r0 = 0x00010000 |
| </pre> |
| <p>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. |
| |
| <p>This behaviour is to allow for the different semantics of the |
| <code>or3</code> and <code>add3</code> instructions. The <code>or3</code> instruction |
| treats its 16-bit immediate argument as unsigned whereas the |
| <code>add3</code> treats its 16-bit immediate as a signed value. So for |
| example: |
| |
| <pre class="smallexample"> seth r0, #shigh(0x00008000) |
| add3 r0, r0, #low(0x00008000) |
| </pre> |
| <p>Produces the correct result in r0, whereas: |
| |
| <pre class="smallexample"> seth r0, #shigh(0x00008000) |
| or3 r0, r0, #low(0x00008000) |
| </pre> |
| <p>Stores 0xffff8000 into r0. |
| |
| <p>Note - the <code>shigh</code> 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 <code>or3</code> instruction is being used rather |
| than an <code>add3</code> instruction. It is up to the programmer to make |
| sure that correct directives are used. |
| |
| <p><a name="index-g_t_0040code_007b_002em32r_007d-directive_002c-M32R-1132"></a><br><dt><code>.m32r</code><dd>The directive performs a similar thing as the <em>-m32r</em> command |
| line option. It tells the assembler to only accept M32R instructions |
| from now on. An instructions from later M32R architectures are |
| refused. |
| |
| <p><a name="index-g_t_0040code_007b_002em32rx_007d-directive_002c-M32RX-1133"></a><br><dt><code>.m32rx</code><dd>The directive performs a similar thing as the <em>-m32rx</em> command |
| line option. It tells the assembler to start accepting the extra |
| instructions in the M32RX ISA as well as the ordinary M32R ISA. |
| |
| <p><a name="index-g_t_0040code_007b_002em32r2_007d-directive_002c-M32R2-1134"></a><br><dt><code>.m32r2</code><dd>The directive performs a similar thing as the <em>-m32r2</em> command |
| line option. It tells the assembler to start accepting the extra |
| instructions in the M32R2 ISA as well as the ordinary M32R ISA. |
| |
| <p><a name="index-g_t_0040code_007b_002elittle_007d-directive_002c-M32RX-1135"></a><br><dt><code>.little</code><dd>The directive performs a similar thing as the <em>-little</em> command |
| line option. It tells the assembler to start producing little-endian |
| code and data. This option should be used with care as producing |
| mixed-endian binary files is fraught with danger. |
| |
| <p><a name="index-g_t_0040code_007b_002ebig_007d-directive_002c-M32RX-1136"></a><br><dt><code>.big</code><dd>The directive performs a similar thing as the <em>-big</em> command |
| line option. It tells the assembler to start producing big-endian |
| code and data. This option should be used with care as producing |
| mixed-endian binary files is fraught with danger. |
| |
| </dl> |
| |
| </body></html> |
| |