1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../css/manpage.css" type="text/css" /> 7 <link rel="stylesheet" href="../css/timetable.css" type="text/css" /> 8 <title>sgn - Sign</title> 9 </head> 10 <body> 11 <h1>sgn - Sign</h1> 12 13 <h2>Calling Format</h2> 14 <div class="section"> 15 <pre class="definition"> 16sgn dest, src0, src1, src2 17</pre> 18 </div> 19 20 <h2>Operands</h2> 21 <div class="section"> 22 <table class="arguments"> 23 <thead> 24 <tr> 25 <th>Name</th> 26 <td>Registers</td> 27 </tr> 28 </thead> 29 <tr> 30 <th>dest</th> 31 <td> 32 An output register or temporary register.<br> 33 </td> 34 </tr> 35 <tr> 36 <th>src0</th> 37 <td> 38 A temporary register or input register.<br> 39 </td> 40 </tr> 41 <tr> 42 <th>src1</th> 43 <td> 44 A temporary register.<br>Cannot specify swizzling or the negative sign.<br> 45 </td> 46 </tr> 47 <tr> 48 <th>src2</th> 49 <td> 50 A temporary register.<br>Cannot specify swizzling or the negative sign.<br> 51 </td> 52 </tr> 53 </table> 54 <p class="notice"> 55 You cannot specify the same register for <SPAN class="argument">src1</SPAN> and <SPAN class="argument">src2</SPAN>.<br> You cannot specify the same register for <SPAN class="argument">src0</SPAN> and <SPAN class="argument">src1</SPAN>.<br> The calculation process uses <SPAN class="argument">src1</SPAN> and <SPAN class="argument">src2</SPAN>.<br> 56 </p> 57 </div> 58 59 <h2>Overview</h2> 60 <div class="section"> 61 <p> 62 Stores a value of <CODE>1</CODE>, <CODE>0</CODE>, or <CODE>-1</CODE> in <SPAN class="argument">dest</SPAN> when <SPAN class="argument">src0</SPAN> is positive, zero, or negative, respectively.<br> 63 </p> 64 </div> 65 66 <h2>Operation</h2> 67 <div class="section"> 68<pre class="definition"> 69for ( each component ) 70{ 71 if ( src0.component < 0 ) 72 dest.component = -1 73 else if ( src0.component == 0 ) 74 dest.component = 0 75 else 76 dest.component = 1 77} 78</pre> 79 </div> 80 81 <h2>Macro Expansion</h2> 82 <div class="section"> 83<pre class="definition"> 84slt src1, src0, -src0 85slt src2, -src0, src0 86add dest, src2, -src1 87</pre> 88 </div> 89 90 <h2>Code Example</h2> 91 <div class="section"> 92<pre class="definition"> 93sgn r0, v1, r2, r3 94</pre> 95 </div> 96 97 <h2>Timetable</h2> 98 <div class="section"> 99 <table class="timetable"> 100 <tr> 101 <th></th> 102 <th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th> 103 </tr> 104 <tr> 105 <th>slt</th> 106 <td class="read">read</td> 107 <td class="SLT">SLT</td> 108 <td class="write">write</td> 109 </tr> 110 <tr> 111 <th>slt</th> 112 <td class="empty"></td> 113 <td class="read">read</td> 114 <td class="SLT">SLT</td> 115 <td class="write">write</td> 116 </tr> 117 <tr> 118 <th>add</th> 119 <td class="empty" colspan="2"></td> 120 <td class="stall">STALL</td> 121 <td class="read">read</td> 122 <td class="ADD">ADD</td> 123 <td class="post">post</td> 124 <td class="write">write</td> 125 <td class="dummy"></td> 126 </tr> 127 </table> 128 </div> 129 130 131 <h2>Revision History</h2> 132 <div class="section"> 133 <dl class="history"> 134 <dt>2011/12/20</dt> 135 <dd>Initial version.<br /> 136 </dd> 137 </dl> 138 </div> 139 140 <hr><p>CONFIDENTIAL</p></body> 141</html>