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>sincos - Sine and cosine</title>
9  </head>
10  <body>
11    <h1>sincos - Sine and cosine</h1>
12
13    <h2>Calling Format</h2>
14    <div class="section">
15      <pre class="definition">
16sincos  dest{ .x | .y | .xy }, src0{ .x | .y | .z | .w }, 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            A temporary register.<br>Must specify any one of  { .x | .y | .xy } as the mask for <SPAN class="argument">dest</SPAN>.<br> The cosine value is output to x and the sine value is output to y.<br> The specified component must have a value between <I>-&pi;</I> and <I>&pi;</I>.<br>
33          </td>
34        </tr>
35        <tr>
36          <th>src0</th>
37          <td>
38            A temporary register or input register.<br>Must specify any one of  { .x | .y | .z | .w } as the component.<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        A different register must be specified for each operand.<br> The content of the z component in <SPAN class="argument">dest</SPAN> is not preserved because it is used during calculations.<br> The calculation process uses <SPAN class="argument">src1</SPAN> and <SPAN class="argument">src2</SPAN>.<br>
56      </p>
57      <p class="warning">
58        The floating-point constant registers c93, c94, and c95 are automatically defined because Taylor expansions require several coefficients.<br> You cannot use this instruction and define either c93, c94, or c95 using the <a href="../definition/def.html">def</a> instruction.<br>
59      </p>
60    </div>
61
62    <h2>Overview</h2>
63    <div class="section">
64      <p>
65        Calculates the sine and cosine of the component value specified by <SPAN class="argument">src0</SPAN> and stores the result in <SPAN class="argument">dest</SPAN>. The units used are radians.<br> This macro calculates an approximate value using a Taylor expansion.<br>
66      </p>
67    </div>
68
69    <h2>Operation</h2>
70    <div class="section">
71<pre class="definition">
72tmp = src0{ .x | .y | .z | .w }
73dest.x = cos ( tmp )
74dest.y = sin ( tmp )
75dest.z = undefined // This is used during calculations
76</pre>
77    </div>
78
79    <h2>Macro Expansion</h2>
80    <div class="section">
81<pre class="definition">
82def     c93, 0xbe0000, 0xbc5555, 0x3f0000, 0x3f0000 // -0.5,   -1/3!,  1.0,  1.0
83def     c94, 0xb56c16, 0xb2a01a, 0x3a5555, 0x381111 // -1/6!,  -1/7!,  1/4!, 1/5!
84def     c95, 0xa927e4, 0xa5ae64, 0x2fa01a, 0x2c71de // -1/10!, -1/11!, 1/8!, 1/9!
85
86mov    src1 , c95
87mov    src2 , c94
88mul     dest.z,  src0{ .x | .y | .z | .w }, src0{ .x | .y | .z | .w }
89mad     dest.xy, dest.z, src1.xy, src1.zw
90mad     dest.xy, dest.z, dest.xy, src2.xy
91mad     dest.xy, dest.z, dest.xy, src2.zw
92mov    src1 , c93
93mad     dest.xy, dest.z, dest.xy, src1.xy
94mad     dest.xy, dest.z, dest.xy, src1.zw
95mul     dest.y,  dest.y, src0{ .x | .y | .z | .w }
96</pre>
97    </div>
98
99    <h2>Code Example</h2>
100    <div class="section">
101<pre class="definition">
102sincos  r0.xy, v1.x, r2, r3
103</pre>
104    </div>
105
106    <h2>Timetable</h2>
107    <div class="section">
108      <table class="timetable">
109        <tr>
110          <th></th>
111          <th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th>
112          <th>11</th><th>12</th><th>13</th><th>14</th><th>15</th><th>16</th><th>17</th><th>18</th><th>19</th><th>20</th>
113          <th>21</th><th>22</th><th>23</th><th>24</th><th>25</th><th>26</th><th>27</th><th>28</th><th>29</th>
114        </tr>
115        <tr>
116          <th>mov</th>
117          <td class="read">read</td>
118          <td class="MOV">mov</td>
119          <td class="write">write
120        </tr>
121        <tr>
122          <th>mov</th>
123          <td class="empty"></td>
124          <td class="read">read</td>
125          <td class="MOV">mov</td>
126          <td class="write">write</td>
127        </tr>
128        <tr>
129          <th>mul</th>
130          <td class="empty" colspan="2"></td>
131          <td class="read">read</td>
132          <td class="MUL">MUL</td>
133          <td class="post">post</td>
134          <td class="write">write</td>
135        </tr>
136        <tr>
137          <th>mad</th>
138          <td class="empty" colspan="3"></td>
139          <td class="stall" colspan="2">STALL</td>
140          <td class="read">read</td>
141          <td class="MUL">MUL</td>
142          <td class="ADD">ADD</td>
143          <td class="post">post</td>
144          <td class="write">write</td>
145        </tr>
146        <tr>
147          <th>mad</th>
148          <td class="empty" colspan="6"></td>
149          <td class="stall" colspan="3">STALL</td>
150          <td class="read">read</td>
151          <td class="MUL">MUL</td>
152          <td class="ADD">ADD</td>
153          <td class="post">post</td>
154          <td class="write">write</td>
155        </tr>
156        <tr>
157          <th>mad</th>
158          <td class="empty" colspan="10"></td>
159          <td class="stall" colspan="3">STALL</td>
160          <td class="read">read</td>
161          <td class="MUL">MUL</td>
162          <td class="ADD">ADD</td>
163          <td class="post">post</td>
164          <td class="write">write</td>
165        </tr>
166        <tr>
167          <th>mov</th>
168          <td class="empty" colspan="14"></td>
169          <td class="read">read</td>
170          <td class="MOV">mov</td>
171          <td class="write">write</td>
172        </tr>
173        <tr>
174          <th>mad</th>
175          <td class="empty" colspan="15"></td>
176          <td class="stall" colspan="2">STALL</td>
177          <td class="read">read</td>
178          <td class="MUL">MUL</td>
179          <td class="ADD">ADD</td>
180          <td class="post">post</td>
181          <td class="write">write</td>
182        </tr>
183        <tr>
184          <th>mad</th>
185          <td class="empty" colspan="18"></td>
186          <td class="stall" colspan="3">STALL</td>
187          <td class="read">read</td>
188          <td class="MUL">MUL</td>
189          <td class="ADD">ADD</td>
190          <td class="post">post</td>
191          <td class="write">write</td>
192        </tr>
193        <tr>
194          <th>mul</th>
195          <td class="empty" colspan="22"></td>
196          <td class="stall" colspan="3">STALL</td>
197          <td class="read">read</td>
198          <td class="MUL">MUL</td>
199          <td class="post">post</td>
200          <td class="write">write</td>
201          <td class="dummy"></td>
202        </tr>
203      </table>
204    </div>
205
206
207  <h2>Revision History</h2>
208  <div class="section">
209    <dl class="history">
210      <dt>2011/12/20</dt>
211      <dd>Initial version.<br />
212      </dd>
213    </dl>
214  </div>
215
216  <hr><p>CONFIDENTIAL</p></body>
217</html>