| <html lang="en"> |
| <head> |
| <title>CR16 Operand Qualifiers - 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="CR16_002dDependent.html#CR16_002dDependent" title="CR16-Dependent"> |
| <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="CR16-Operand-Qualifiers"></a> |
| <p> |
| Up: <a rel="up" accesskey="u" href="CR16_002dDependent.html#CR16_002dDependent">CR16-Dependent</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">9.6.1 CR16 Operand Qualifiers</h4> |
| |
| <p><a name="index-CR16-Operand-Qualifiers-694"></a> |
| The National Semiconductor CR16 target of <code>as</code> has a few machine dependent operand qualifiers. |
| |
| <p>Operand expression type qualifier is an optional field in the instruction operand, to determines the type of the expression field of an operand. The <code>@</code> is required. CR16 architecture uses one of the following expression qualifiers: |
| |
| <dl> |
| <dt><code>s</code><dd>- <code>Specifies expression operand type as small</code> |
| <br><dt><code>m</code><dd>- <code>Specifies expression operand type as medium</code> |
| <br><dt><code>l</code><dd>- <code>Specifies expression operand type as large</code> |
| <br><dt><code>c</code><dd>- <code>Specifies the CR16 Assembler generates a relocation entry for the operand, where pc has implied bit, the expression is adjusted accordingly. The linker uses the relocation entry to update the operand address at link time.</code> |
| <br><dt><code>got/GOT</code><dd>- <code>Specifies the CR16 Assembler generates a relocation entry for the operand, offset from Global Offset Table. The linker uses this relocation entry to update the operand address at link time</code> |
| <br><dt><code>cgot/cGOT</code><dd>- <code>Specifies the CompactRISC Assembler generates a relocation entry for the operand, where pc has implied bit, the expression is adjusted accordingly. The linker uses the relocation entry to update the operand address at link time.</code> |
| </dl> |
| |
| <p>CR16 target operand qualifiers and its size (in bits): |
| |
| <dl> |
| <dt>‘<samp><span class="samp">Immediate Operand</span></samp>’<dd>- s —– 4 bits |
| <br><dt>‘<samp></samp>’<dd>- m —– 16 bits, for movb and movw instructions. |
| <br><dt>‘<samp></samp>’<dd>- m —– 20 bits, movd instructions. |
| <br><dt>‘<samp></samp>’<dd>- l —– 32 bits |
| |
| <br><dt>‘<samp><span class="samp">Absolute Operand</span></samp>’<dd>- s —– Illegal specifier for this operand. |
| <br><dt>‘<samp></samp>’<dd>- m —– 20 bits, movd instructions. |
| |
| <br><dt>‘<samp><span class="samp">Displacement Operand</span></samp>’<dd>- s —– 8 bits |
| <br><dt>‘<samp></samp>’<dd>- m —– 16 bits |
| <br><dt>‘<samp></samp>’<dd>- l —– 24 bits |
| </dl> |
| |
| <p>For example: |
| <pre class="example"> 1 <code>movw $_myfun@c,r1</code> |
| |
| This loads the address of _myfun, shifted right by 1, into r1. |
| |
| 2 <code>movd $_myfun@c,(r2,r1)</code> |
| |
| This loads the address of _myfun, shifted right by 1, into register-pair r2-r1. |
| |
| 3 <code>_myfun_ptr:</code> |
| <code>.long _myfun@c</code> |
| <code>loadd _myfun_ptr, (r1,r0)</code> |
| <code>jal (r1,r0)</code> |
| |
| This .long directive, the address of _myfunc, shifted right by 1 at link time. |
| |
| 4 <code>loadd _data1@GOT(r12), (r1,r0)</code> |
| |
| This loads the address of _data1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r2-r1. |
| |
| 5 <code>loadd _myfunc@cGOT(r12), (r1,r0)</code> |
| |
| This loads the address of _myfun, shifted right by 1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r1-r0. |
| </pre> |
| <!-- Copyright 2002, 2004 Free Software Foundation, Inc. --> |
| <!-- This is part of the GAS manual. --> |
| <!-- For copying conditions, see the file as.texinfo. --> |
| <!-- CRIS description contributed by Axis Communications. --> |
| </body></html> |
| |