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>m4x4 - 4x4 multiply</title> 9 </head> 10 <body> 11 <h1>m4x4 - 4x4 multiply</h1> 12 13 <h2>Calling Format</h2> 14 <div class="section"> 15 <pre class="definition"> 16m4x4 dest, src0, src1 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>Cannot use anything other than the default mask { .xyzw }.<br> 33 </td> 34 </tr> 35 <tr> 36 <th>src0</th> 37 <td> 38 A temporary register, an input register, or a floating-point constant register.<br> 39 </td> 40 </tr> 41 <tr> 42 <th>src1</th> 43 <td> 44 A temporary register, an input register, or a floating-point constant register.<br>Specifies the starting register of a 4x4 matrix. (In other words, if <SPAN class="argument">src1</SPAN> is <CODE>r0</CODE>, then the 4x4 matrix is stored in <CODE>r0</CODE>, <CODE>r1</CODE>, <CODE>r2</CODE> and <CODE>r3</CODE>.)<br> 45 </td> 46 </tr> 47 </table> 48 <p class="notice"> 49 You cannot specify a floating-point constant register for both <SPAN class="argument">src0</SPAN> and <SPAN class="argument">src1</SPAN>.<br> You cannot specify an input register for both <SPAN class="argument">src0</SPAN> and <SPAN class="argument">src1</SPAN> at the same time.<br> You cannot specify the same register for <SPAN class="argument">dest</SPAN> and <SPAN class="argument">src0</SPAN>.<br> 50 </p> 51 <p class="warning"> 52 If you set <SPAN class="argument">dest</SPAN> to the registers that immediately follow <SPAN class="argument">src1</SPAN> (this is <SPAN class="argument">src2</SPAN>, <SPAN class="argument">src3</SPAN>, <SPAN class="argument">src4</SPAN> in Macro Expansion below), there is no way to anticipate the result because the contents of those registers will be updated during the execution of the expanded instructions.<br> 53 </p> 54 </div> 55 56 <h2>Overview</h2> 57 <div class="section"> 58 <p> 59 Stores the result of multiplying a 4x4 matrix and a 4-component vector in <SPAN class="argument">dest</SPAN>.<br> 60 </p> 61 </div> 62 63 <h2>Operation</h2> 64 <div class="section"> 65<pre class="definition"> 66src2 = Next_Index_Of ( src1 ) 67src3 = Next_Index_Of ( src2 ) 68src4 = Next_Index_Of ( src3 ) 69dest.x = ( src0.x * src1.x ) + ( src0.y * src1.y ) + ( src0.z * src1.z ) + ( src0.w * src1.w ) 70dest.y = ( src0.x * src2.x ) + ( src0.y * src2.y ) + ( src0.z * src2.z ) + ( src0.w * src2.w ) 71dest.z = ( src0.x * src3.x ) + ( src0.y * src3.y ) + ( src0.z * src3.z ) + ( src0.w * src3.w ) 72dest.w = ( src0.x * src4.x ) + ( src0.y * src4.y ) + ( src0.z * src4.z ) + ( src0.w * src4.w ) 73</pre> 74 </div> 75 76 <h2>Macro Expansion</h2> 77 <div class="section"> 78<pre class="definition"> 79dp4 dest.x, src0, src1 80dp4 dest.y, src0, src2 // src2 = next index of src1 81dp4 dest.z, src0, src3 // src3 = next index of src2 82dp4 dest.w, src0, src4 // src4 = next index of src3 83</pre> 84 </div> 85 86 <h2>Code Example</h2> 87 <div class="section"> 88<pre class="definition"> 89m4x4 r0, r1, c0 90// This is expanded as follows 91// dp4 r0.x, r1, c0 92// dp4 r0.y, r1, c1 93// dp4 r0.z, r1, c2 94// dp4 r0.w, r1, c3 95</pre> 96 </div> 97 98 <h2>Timetable</h2> 99 <div class="section"> 100 <table class="timetable"> 101 <tr> 102 <th></th> 103 <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> 104 </tr> 105 <tr> 106 <th>dp4</th> 107 <td class="read">read</td> 108 <td class="MUL">MUL</td> 109 <td class="ADD">ADD</td> 110 <td class="ADD">ADD</td> 111 <td class="post">post</td> 112 <td class="write">write</td> 113 </tr> 114 <tr> 115 <th>dp4</th> 116 <td class="empty"></td> 117 <td class="read">read</td> 118 <td class="MUL">MUL</td> 119 <td class="ADD">ADD</td> 120 <td class="ADD">ADD</td> 121 <td class="post">post</td> 122 <td class="write">write</td> 123 </tr> 124 <tr> 125 <th>dp4</th> 126 <td class="empty" colspan="2"></td> 127 <td class="read">read</td> 128 <td class="MUL">MUL</td> 129 <td class="ADD">ADD</td> 130 <td class="ADD">ADD</td> 131 <td class="post">post</td> 132 <td class="write">write</td> 133 </tr> 134 <tr> 135 <th>dp4</th> 136 <td class="empty" colspan="3"></td> 137 <td class="read">read</td> 138 <td class="MUL">MUL</td> 139 <td class="ADD">ADD</td> 140 <td class="ADD">ADD</td> 141 <td class="post">post</td> 142 <td class="write">write</td> 143 <td class="dummy"></td> 144 </tr> 145 </table> 146 </div> 147 148 149 <h2>Revision History</h2> 150 <div class="section"> 151 <dl class="history"> 152 <dt>2011/12/20</dt> 153 <dd>Initial version.<br /> 154 </dd> 155 </dl> 156 </div> 157 158 <hr><p>CONFIDENTIAL</p></body> 159</html>