<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 rel="next" href="CR16-Syntax.html#CR16-Syntax" title="CR16 Syntax">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".

Copyright (C) 1991-2015 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>
</head>
<body>
<div class="node">
<a name="CR16-Operand-Qualifiers"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="CR16-Syntax.html#CR16-Syntax">CR16 Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="CR16_002dDependent.html#CR16_002dDependent">CR16-Dependent</a>
<hr>
</div>

<h4 class="subsection">9.7.1 CR16 Operand Qualifiers</h4>

<p><a name="index-CR16-Operand-Qualifiers-818"></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>&lsquo;<samp><span class="samp">Immediate Operand: s</span></samp>&rsquo;<dd>4 bits.

     <br><dt>&lsquo;<samp><span class="samp">Immediate Operand: m</span></samp>&rsquo;<dd>16 bits, for movb and movw instructions.

     <br><dt>&lsquo;<samp><span class="samp">Immediate Operand: m</span></samp>&rsquo;<dd>20 bits, movd instructions.

     <br><dt>&lsquo;<samp><span class="samp">Immediate Operand: l</span></samp>&rsquo;<dd>32 bits.

     <br><dt>&lsquo;<samp><span class="samp">Absolute Operand: s</span></samp>&rsquo;<dd>Illegal specifier for this operand.

     <br><dt>&lsquo;<samp><span class="samp">Absolute Operand: m</span></samp>&rsquo;<dd>20 bits, movd instructions.

     <br><dt>&lsquo;<samp><span class="samp">Displacement Operand: s</span></samp>&rsquo;<dd>8 bits.

     <br><dt>&lsquo;<samp><span class="samp">Displacement Operand: m</span></samp>&rsquo;<dd>16 bits.

     <br><dt>&lsquo;<samp><span class="samp">Displacement Operand: l</span></samp>&rsquo;<dd>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>
   </body></html>