forked from NRZCode/ia32-64
97 lines
4.2 KiB
HTML
97 lines
4.2 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:x86="http://www.felixcloutier.com/x86"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" href="style.css"></link><title>SHA256RNDS2
|
||
— Perform Two Rounds of SHA256 Operation</title></head><body><header><nav><ul><li><a href='index.html'>Index</a></li><li>December 2023</li></ul></nav></header><h1>SHA256RNDS2
|
||
— Perform Two Rounds of SHA256 Operation</h1>
|
||
|
||
<table>
|
||
<tr>
|
||
<th>Opcode/Instruction</th>
|
||
<th>Op/En</th>
|
||
<th>64/32 bit Mode Support</th>
|
||
<th>CPUID Feature Flag</th>
|
||
<th>Description</th></tr>
|
||
<tr>
|
||
<td>NP 0F 38 CB /r SHA256RNDS2 xmm1, xmm2/m128, <XMM0></td>
|
||
<td>RMI</td>
|
||
<td>V/V</td>
|
||
<td>SHA</td>
|
||
<td>Perform 2 rounds of SHA256 operation using an initial SHA256 state (C,D,G,H) from xmm1, an initial SHA256 state (A,B,E,F) from xmm2/m128, and a pre-computed sum of the next 2 round message dwords and the corresponding round constants from the implicit operand XMM0, storing the updated SHA256 state (A,B,E,F) result in xmm1.</td></tr></table>
|
||
<h2 id="instruction-operand-encoding">Instruction Operand Encoding<a class="anchor" href="#instruction-operand-encoding">
|
||
¶
|
||
</a></h2>
|
||
<table>
|
||
<tr>
|
||
<th>Op/En</th>
|
||
<th>Operand 1</th>
|
||
<th>Operand 2</th>
|
||
<th>Operand 3</th></tr>
|
||
<tr>
|
||
<td>RMI</td>
|
||
<td>ModRM:reg (r, w)</td>
|
||
<td>ModRM:r/m (r)</td>
|
||
<td>Implicit XMM0 (r)</td></tr></table>
|
||
<h2 id="description">Description<a class="anchor" href="#description">
|
||
¶
|
||
</a></h2>
|
||
<p>The SHA256RNDS2 instruction performs 2 rounds of SHA256 operation using an initial SHA256 state (C,D,G,H) from the first operand, an initial SHA256 state (A,B,E,F) from the second operand, and a pre-computed sum of the next 2 round message dwords and the corresponding round constants from the implicit operand xmm0. Note that only the two lower dwords of XMM0 are used by the instruction.</p>
|
||
<p>The updated SHA256 state (A,B,E,F) is written to the first operand, and the second operand can be used as the updated state (C,D,G,H) in later rounds.</p>
|
||
<h2 id="operation">Operation<a class="anchor" href="#operation">
|
||
¶
|
||
</a></h2>
|
||
<h3 id="sha256rnds2">SHA256RNDS2<a class="anchor" href="#sha256rnds2">
|
||
¶
|
||
</a></h3>
|
||
<pre>A_0 := SRC2[127:96];
|
||
B_0 := SRC2[95:64];
|
||
C_0 := SRC1[127:96];
|
||
D_0 := SRC1[95:64];
|
||
E_0 := SRC2[63:32];
|
||
F_0 := SRC2[31:0];
|
||
G_0 := SRC1[63:32];
|
||
H_0 := SRC1[31:0];
|
||
WK<sub>0</sub> := XMM0[31: 0];
|
||
WK<sub>1</sub> := XMM0[63: 32];
|
||
FOR i = 0 to 1
|
||
A_(i +1) :=
|
||
Ch (E_i, F_i, G_i) +Σ<sub>1</sub>( E_i) +WK<sub>i</sub>+ H_i + Maj(A_i , B_i, C_i) +Σ<sub>0</sub>( A_i);
|
||
B_(i +1) :=
|
||
A_i;
|
||
C_(i +1) :=
|
||
B_i ;
|
||
D_(i +1) :=
|
||
C_i;
|
||
E_(i +1) :=
|
||
Ch (E_i, F_i, G_i) +Σ<sub>1</sub>( E_i) +WK<sub>i</sub>+ H_i + D_i;
|
||
F_(i +1) :=
|
||
E_i ;
|
||
G_(i +1) :=
|
||
F_i;
|
||
H_(i +1) :=
|
||
G_i;
|
||
ENDFOR
|
||
DEST[127:96] := A_2;
|
||
DEST[95:64] := B_2;
|
||
DEST[63:32] := E_2;
|
||
DEST[31:0] := F_2;
|
||
</pre>
|
||
<h2 id="intel-c-c++-compiler-intrinsic-equivalent">Intel C/C++ Compiler Intrinsic Equivalent<a class="anchor" href="#intel-c-c++-compiler-intrinsic-equivalent">
|
||
¶
|
||
</a></h2>
|
||
<pre>SHA256RNDS2 __m128i _mm_sha256rnds2_epu32(__m128i, __m128i, __m128i);
|
||
</pre>
|
||
<h2 id="flags-affected">Flags Affected<a class="anchor" href="#flags-affected">
|
||
¶
|
||
</a></h2>
|
||
<p>None.</p>
|
||
<h2 class="exceptions" id="simd-floating-point-exceptions">SIMD Floating-Point Exceptions<a class="anchor" href="#simd-floating-point-exceptions">
|
||
¶
|
||
</a></h2>
|
||
<p>None.</p>
|
||
<h2 class="exceptions" id="other-exceptions">Other Exceptions<a class="anchor" href="#other-exceptions">
|
||
¶
|
||
</a></h2>
|
||
<p>See <span class="not-imported">Table 2-21</span>, “Type 4 Class Exception Conditions.”</p><footer><p>
|
||
This UNOFFICIAL, mechanically-separated, non-verified reference is provided for convenience, but it may be
|
||
inc<span style="opacity: 0.2">omp</span>lete or b<sub>r</sub>oke<sub>n</sub> in various obvious or non-obvious
|
||
ways. Refer to <a href="https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4">Intel® 64 and IA-32 Architectures Software Developer’s Manual</a> for anything serious.
|
||
</p></footer></body></html>
|