ia32-64/x86/haddpd.html
2025-07-08 02:23:29 -03:00

267 lines
33 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>HADDPD
— Packed Double Precision Floating-Point Horizontal Add</title></head><body><header><nav><ul><li><a href='index.html'>Index</a></li><li>December 2023</li></ul></nav></header><h1>HADDPD
— Packed Double Precision Floating-Point Horizontal Add</h1>
<table>
<tr>
<th>Opcode/Instruction</th>
<th>Op/En</th>
<th>64/32-bit Mode</th>
<th>CPUID Feature Flag</th>
<th>Description</th></tr>
<tr>
<td>66 0F 7C /r HADDPD xmm1, xmm2/m128</td>
<td>RM</td>
<td>V/V</td>
<td>SSE3</td>
<td>Horizontal add packed double precision floating-point values from xmm2/m128 to xmm1.</td></tr>
<tr>
<td>VEX.128.66.0F.WIG 7C /r VHADDPD xmm1,xmm2, xmm3/m128</td>
<td>RVM</td>
<td>V/V</td>
<td>AVX</td>
<td>Horizontal add packed double precision floating-point values from xmm2 and xmm3/mem.</td></tr>
<tr>
<td>VEX.256.66.0F.WIG 7C /r VHADDPD ymm1, ymm2, ymm3/m256</td>
<td>RVM</td>
<td>V/V</td>
<td>AVX</td>
<td>Horizontal add packed double precision floating-point values from ymm2 and ymm3/mem.</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>
<th>Operand 4</th></tr>
<tr>
<td>RM</td>
<td>ModRM:reg (r, w)</td>
<td>ModRM:r/m (r)</td>
<td>N/A</td>
<td>N/A</td></tr>
<tr>
<td>RVM</td>
<td>ModRM:reg (w)</td>
<td>VEX.vvvv (r)</td>
<td>ModRM:r/m (r)</td>
<td>N/A</td></tr></table>
<h2 id="description">Description<a class="anchor" href="#description">
</a></h2>
<p>Adds the double precision floating-point values in the high and low quadwords of the destination operand and stores the result in the low quadword of the destination operand.</p>
<p>Adds the double precision floating-point values in the high and low quadwords of the source operand and stores the result in the high quadword of the destination operand.</p>
<p>In 64-bit mode, use of the REX.R prefix permits this instruction to access additional registers (XMM8-XMM15).</p>
<p>See <a href='haddpd.html#fig-3-17'>Figure 3-17</a> for HADDPD; see <a href='haddpd.html#fig-3-18'>Figure 3-18</a> for VHADDPD.</p>
<figure id="fig-3-17">
<svg style="width: 397.878pt; height: 217.50719999999998pt" viewBox="131.082 0.0 336.565 186.256">
<g xmlns="http://www.w3.org/2000/svg" style="fill: none; stroke: none">
<rect height="181.256" style="stroke: rgb(0%, 0%, 0%)" width="331.565" x="133.582" y="0.0"></rect>
<rect height="26.525000000000002" style="fill: rgb(0%, 0%, 0%)" width="132.626" x="292.733" y="25.42100000000005"></rect>
<rect height="26.525000000000002" style="stroke: rgb(0%, 0%, 0%)" width="132.626" x="292.733" y="25.420000000000016"></rect>
<rect height="26.525000000000002" style="fill: rgb(0%, 0%, 0%)" width="132.626" x="160.107" y="25.42100000000005"></rect>
<rect height="26.525000000000002" style="stroke: rgb(0%, 0%, 0%)" width="132.626" x="160.107" y="25.420000000000016"></rect>
<rect height="26.525000000000002" style="fill: rgb(0%, 0%, 0%)" width="132.626" x="292.733" y="72.945"></rect>
<rect height="26.525000000000002" style="stroke: rgb(0%, 0%, 0%)" width="132.626" x="292.733" y="72.945"></rect>
<rect height="26.525000000000002" style="fill: rgb(0%, 0%, 0%)" width="132.626" x="160.107" y="72.945"></rect>
<rect height="26.525000000000002" style="stroke: rgb(0%, 0%, 0%)" width="132.626" x="160.107" y="72.945"></rect>
<path d="M 226.42000000000002 125.34700000000001 L 226.42000000000002 119.364 L 146.844 119.364 L 146.844 62.442999999999984 L 359.04600000000005 62.442999999999984 L 359.04600000000005 51.940999999999974" style="fill-rule: nonzero; stroke: rgb(0%, 0%, 0%)"></path>
<path d="M 229.132 124.993 L 226.42000000000002 130.416 L 223.709 124.993 L 229.132 124.993" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<rect height="26.525000000000002" style="fill: rgb(0%, 0%, 0%)" width="132.626" x="160.107" y="130.417"></rect>
<rect height="26.525000000000002" style="stroke: rgb(0%, 0%, 0%)" width="132.626" x="160.107" y="130.416"></rect>
<rect height="26.525000000000002" style="fill: rgb(0%, 0%, 0%)" width="132.626" x="292.733" y="130.417"></rect>
<rect height="26.525000000000002" style="stroke: rgb(0%, 0%, 0%)" width="132.626" x="292.733" y="130.416"></rect>
<path d="M 359.046 125.34700000000001 L 359.046 110.52200000000002 L 226.42 110.52200000000002 L 226.42 99.47" style="fill-rule: nonzero; stroke: rgb(0%, 0%, 0%)"></path>
<path d="M 361.758 124.993 L 359.04699999999997 130.416 L 356.335 124.993 L 361.758 124.993" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 226.42000000000002 51.946000000000026 L 226.42000000000002 62.448000000000036" style="fill-rule: nonzero; stroke: rgb(0%, 0%, 0%)"></path>
<path d="M 359.04600000000005 99.47000000000003 L 359.04600000000005 110.52200000000002" style="fill-rule: nonzero; stroke: rgb(0%, 0%, 0%)"></path>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="104.36364469999998" x="240.5524" y="17.82435300000003">HADDPD xmm1, xmm2/m128</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="21.393014600000015" x="430.61542376" y="37.975598200000036">xmm2</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="28.403510200000028" x="212.21460000000002" y="42.69135300000005">[127:64]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="19.663968600000032" x="349.2124" y="42.69135300000005">[63:0]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="21.840994700000067" x="430.61542376" y="47.40675820000001">/m128</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="21.393014600000015" x="430.61542376" y="90.21557937000003">xmm1</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="28.403510200000028" x="212.21460000000002" y="90.215753">[127:64]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.27771180000002pt; fill: #000" textLength="19.663968600000032" x="349.2124" y="90.215753">[63:0]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="24.458141599999976" x="430.61511584000004" y="142.97130425">Result:</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="69.67269450000006" x="191.5839" y="142.971553">xmm2/m128[63:0] +</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="99.81311000000011" x="309.1397" y="147.687153">xmm1[63:0] + xmm1[127:64]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="21.393014600000015" x="430.61511584000004" y="152.40246425">xmm1</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="71.63751950000002" x="190.6014875" y="152.402713">xmm2/m128[127:64]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="28.403510200000028" x="212.22481709000002" y="170.90954506000003">[127:64]</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 7.277711799999992pt; fill: #000" textLength="19.663968600000032" x="353.64348943000005" y="170.90954506000003">[63:0]</text></g></svg>
<figcaption><a href='haddpd.html#fig-3-17'>Figure 3-17</a>. HADDPD—Packed Double Precision Floating-Point Horizontal Add</figcaption></figure>
<figure id="fig-3-18">
<svg style="width: 380.950842192pt; height: 97.77600000000002pt" viewBox="139.10100483999997 0.0 322.45903516 86.48000000000002">
<g xmlns="http://www.w3.org/2000/svg" style="fill: none; stroke: none">
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="161.82" y="67.50002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="235.86" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="161.58" y="81.00002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="161.58" y="67.5"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.22" x="236.10000000000002" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="236.10000000000002" y="67.50002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48001000000000005" x="310.08" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="235.86" y="81.00002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="235.86" y="67.5"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.28" x="310.32" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="310.32" y="67.50002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.47998" x="384.36" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="310.08" y="81.00002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48001000000000005" x="310.08" y="67.5"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.22" x="384.6" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="384.6" y="67.50002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48004" x="458.58" y="67.74000000000001"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="384.36" y="81.00002000000006"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.47998" x="384.36" y="67.5"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.28" x="161.82" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="161.82" y="2.0000000063191692e-05"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="235.86" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="161.58" y="13.500020000000063"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="161.58" y="0.0"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.22" x="236.10000000000002" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="236.10000000000002" y="2.0000000063191692e-05"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48001000000000005" x="310.08" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="235.86" y="13.500020000000063"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="235.86" y="0.0"></rect>
<path d="M 263.40000000000003 58.139999999999986 L 263.52000000000004 57.960000000000036 L 263.58000000000004 57.77999999999997 C 263.73 56.76999999999998 262.68100000000004 56.222999999999956 261.90000000000003 56.819999999999936L 261.78000000000003 56.93999999999994 L 261.66 57.120000000000005 C 261.25700000000006 58.168000000000006 262.47600000000006 58.90499999999997 263.1 58.379999999999995L 263.28000000000003 58.25999999999999 L 263.40000000000003 58.139999999999986" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 262.62 57.539999999999964 L 265.14 54.059999999999945 L 265.56 53.57999999999993 L 265.92 54.059999999999945 L 275.52 66.36000000000001 L 276.6 67.74000000000001 L 274.98 67.13999999999999 L 260.34000000000003 61.799999999999955 L 259.68 61.559999999999945 L 260.1 61.01999999999998 L 260.64 60.83999999999992 L 275.28000000000003 66.17999999999995 L 274.98 67.13999999999999 L 274.74 66.95999999999992 L 265.14 54.65999999999997 L 265.92 54.059999999999945 L 265.92 54.65999999999997 L 263.4 58.139999999999986" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 260.1 61.01999999999998 L 262.62 57.539999999999964 L 263.40000000000003 58.139999999999986 L 260.88 61.620000000000005" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 262.98 57.84000000000003 L 265.5 54.360000000000014 L 275.1 66.66000000000008 L 260.46000000000004 61.32000000000005" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 202.92000000000002 12.960000000000036 L 201.78000000000003 14.580000000000041 L 262.08000000000004 58.379999999999995 L 263.22 56.75999999999999" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.28" x="310.32" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="310.32" y="2.0000000063191692e-05"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.47998" x="384.36" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="310.08" y="13.500020000000063"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48001000000000005" x="310.08" y="0.0"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.22" x="384.6" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="384.6" y="2.0000000063191692e-05"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48004" x="458.58" y="0.2400000000000091"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="384.36" y="13.500020000000063"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.47998" x="384.36" y="0.0"></rect>
<path d="M 425.1 51.41999999999996 L 425.28000000000003 51.41999999999996 L 425.46000000000004 51.360000000000014 C 426.39300000000003 50.93799999999999 426.27500000000003 49.702999999999975 425.28000000000003 49.43999999999994L 424.92 49.43999999999994 L 424.68 49.5 L 424.56 49.620000000000005 L 424.38 49.74000000000001 L 424.26000000000005 49.860000000000014 L 424.08000000000004 50.39999999999998 C 424.204 50.78099999999995 424.156 51.045999999999935 424.56 51.24000000000001L 424.68 51.360000000000014 L 424.92 51.41999999999996 L 425.1 51.41999999999996" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 425.1 50.460000000000036 L 430.08000000000004 50.460000000000036 L 429.90000000000003 51.120000000000005 L 425.58000000000004 66.12 L 425.1 67.80000000000007 L 424.62 66.12 L 420.3 51.120000000000005 L 420.12 50.460000000000036 L 420.78000000000003 50.460000000000036 L 421.26000000000005 50.82000000000005 L 425.58000000000004 65.82000000000005 L 424.62 66.12 L 424.62 65.82000000000005 L 428.94 50.82000000000005 L 429.90000000000003 51.120000000000005 L 429.42 51.48000000000002 L 425.1 51.48000000000002" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<rect height="1.02" style="fill: rgb(0%, 0%, 0%)" width="4.32" x="420.78000000000003" y="50.460000000000036"></rect>
<path d="M 425.1 50.940000000000055 L 429.42 50.940000000000055 L 425.1 65.94000000000005 L 420.78000000000003 50.940000000000055" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<rect height="36.660000000000004" style="fill: rgb(0%, 0%, 0%)" width="1.98" x="424.14" y="13.740000000000009"></rect>
<rect height="1.98" style="fill: rgb(0%, 0%, 0%)" width="74.28" x="202.32" y="39.77999999999997"></rect>
<rect height="1.98" style="fill: rgb(0%, 0%, 0%)" width="74.28" x="350.82" y="39.77999999999997"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.28" x="161.82" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="161.82" y="30.360020000000077"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="235.86" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="161.58" y="43.86002000000008"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="161.58" y="30.360000000000014"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.22" x="236.10000000000002" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="236.10000000000002" y="30.360020000000077"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48001000000000005" x="310.08" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="235.86" y="43.86002000000008"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48" x="235.86" y="30.360000000000014"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.28" x="310.32" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="310.32" y="30.360020000000077"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.47998" x="384.36" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.52" x="310.08" y="43.86002000000008"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48001000000000005" x="310.08" y="30.360000000000014"></rect>
<rect height="13.5" style="fill: rgb(100%, 100%, 100%)" width="74.22" x="384.6" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="384.6" y="30.360020000000077"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.48004" x="458.58" y="30.600000000000023"></rect>
<rect height="0.47998" style="fill: rgb(0%, 0%, 0%)" width="74.46000000000001" x="384.36" y="43.86002000000008"></rect>
<rect height="13.74" style="fill: rgb(0%, 0%, 0%)" width="0.47998" x="384.36" y="30.360000000000014"></rect>
<path d="M 411.72 58.440000000000055 L 411.78000000000003 58.260000000000105 L 411.84000000000003 58.08000000000004 C 412.16700000000003 57.17700000000002 410.918 56.418000000000006 410.22 57.120000000000005L 410.04 57.30000000000007 L 409.98 57.48000000000002 C 409.533 58.41100000000006 410.79 59.224000000000046 411.42 58.680000000000064L 411.6 58.56000000000006 L 411.72 58.440000000000055" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 410.88 57.84000000000003 L 413.34 54.30000000000007 L 413.76 53.75999999999999 L 414.18 54.30000000000007 L 424.02 66.42000000000007 L 425.1 67.80000000000007 L 423.48 67.20000000000005 L 408.71999999999997 62.16000000000008 L 408.06 61.92000000000007 L 408.42 61.379999999999995 L 409.02 61.200000000000045 L 423.78 66.24000000000001 L 423.48 67.20000000000005 L 423.24 67.01999999999998 L 413.4 54.89999999999998 L 414.18 54.30000000000007 L 414.18 54.89999999999998 L 411.71999999999997 58.440000000000055" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 408.42 61.379999999999995 L 410.88 57.84000000000003 L 411.72 58.43999999999994 L 409.26 61.98000000000002" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 411.3 58.139999999999986 L 413.76 54.60000000000002 L 423.6 66.72000000000003 L 408.84000000000003 61.67999999999995" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 348.06 12.960000000000036 L 346.92 14.580000000000041 L 410.34000000000003 58.680000000000064 L 411.48 57.06000000000006" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 276.6 51.41999999999996 L 276.78000000000003 51.41999999999996 L 276.96000000000004 51.360000000000014 L 277.32000000000005 51.120000000000005 L 277.44 51.0 L 277.5 50.819999999999936 L 277.56 50.639999999999986 L 277.56 50.219999999999914 C 277.384 49.660999999999945 277.46700000000004 49.86399999999992 276.96000000000004 49.5L 276.78000000000003 49.43999999999994 L 276.36 49.43999999999994 C 275.404 49.76299999999992 275.26800000000003 50.85799999999995 276.18 51.360000000000014L 276.36 51.41999999999996 L 276.6 51.41999999999996" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 276.6 50.460000000000036 L 281.52000000000004 50.460000000000036 L 281.34000000000003 51.120000000000005 L 277.08000000000004 66.12 L 276.6 67.80000000000007 L 276.12 66.12 L 271.8 51.120000000000005 L 271.62 50.460000000000036 L 272.28000000000003 50.460000000000036 L 272.76000000000005 50.82000000000005 L 277.08000000000004 65.82000000000005 L 276.12 66.12 L 276.12 65.82000000000005 L 280.38 50.82000000000005 L 281.34000000000003 51.120000000000005 L 280.86 51.48000000000002 L 276.6 51.48000000000002" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<rect height="1.02" style="fill: rgb(0%, 0%, 0%)" width="4.32" x="272.28000000000003" y="50.460000000000036"></rect>
<path d="M 276.6 50.940000000000055 L 280.86 50.940000000000055 L 276.6 65.94000000000005 L 272.28000000000003 50.940000000000055" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<rect height="36.660000000000004" style="fill: rgb(0%, 0%, 0%)" width="1.98" x="275.64" y="13.740000000000009"></rect>
<path d="M 198.96 51.41999999999996 L 199.14000000000001 51.41999999999996 L 199.32000000000002 51.360000000000014 C 200.25300000000001 50.93799999999999 200.13500000000002 49.702999999999975 199.14000000000001 49.43999999999994L 198.78 49.43999999999994 L 198.54000000000002 49.5 L 198.42000000000002 49.620000000000005 L 198.24 49.74000000000001 L 198.12 49.860000000000014 L 198.0 50.219999999999914 L 197.94 50.39999999999998 C 198.06400000000002 50.78099999999995 198.01600000000002 51.045999999999935 198.42000000000002 51.24000000000001L 198.54000000000002 51.360000000000014 L 198.78 51.41999999999996 L 198.96 51.41999999999996" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 198.96 50.460000000000036 L 203.94 50.460000000000036 L 203.76000000000002 51.120000000000005 L 199.44 66.12 L 198.96 67.80000000000007 L 198.48000000000002 66.12 L 194.16 51.120000000000005 L 193.98000000000002 50.460000000000036 L 194.64000000000001 50.460000000000036 L 195.12 50.82000000000005 L 199.44 65.82000000000005 L 198.48000000000002 66.12 L 198.48000000000002 65.82000000000005 L 202.8 50.82000000000005 L 203.76000000000002 51.120000000000005 L 203.28 51.48000000000002 L 198.96 51.48000000000002" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<rect height="1.02" style="fill: rgb(0%, 0%, 0%)" width="4.32" x="194.64000000000001" y="50.460000000000036"></rect>
<path d="M 198.96 50.940000000000055 L 203.28 50.940000000000055 L 198.96 65.94000000000005 L 194.64000000000001 50.940000000000055" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<rect height="6.300000000000001" style="fill: rgb(0%, 0%, 0%)" width="1.98" x="198.0" y="44.10000000000002"></rect>
<path d="M 347.46 51.41999999999996 L 347.64 51.41999999999996 L 347.88 51.360000000000014 L 348.0 51.24000000000001 L 348.18 51.120000000000005 L 348.29999999999995 51.0 L 348.35999999999996 50.819999999999936 L 348.41999999999996 50.639999999999986 L 348.47999999999996 50.39999999999998 L 348.29999999999995 49.860000000000014 L 348.18 49.74000000000001 L 348.0 49.620000000000005 L 347.88 49.5 L 347.64 49.43999999999994 L 347.28 49.43999999999994 C 346.28499999999997 49.702999999999975 346.167 50.93799999999999 347.09999999999997 51.360000000000014L 347.28 51.41999999999996 L 347.46 51.41999999999996" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 347.46 50.460000000000036 L 352.44 50.460000000000036 L 352.26 51.120000000000005 L 347.94 66.12 L 347.46 67.80000000000007 L 346.97999999999996 66.12 L 342.65999999999997 51.120000000000005 L 342.47999999999996 50.460000000000036 L 343.14 50.460000000000036 L 343.62 50.82000000000005 L 347.94 65.82000000000005 L 346.97999999999996 66.12 L 346.97999999999996 65.82000000000005 L 351.29999999999995 50.82000000000005 L 352.26 51.120000000000005 L 351.78 51.48000000000002 L 347.46 51.48000000000002" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<rect height="1.02" style="fill: rgb(0%, 0%, 0%)" width="4.32" x="343.14" y="50.460000000000036"></rect>
<path d="M 347.46 50.940000000000055 L 351.78 50.940000000000055 L 347.46 65.94000000000005 L 343.14 50.940000000000055" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<rect height="6.300000000000001" style="fill: rgb(0%, 0%, 0%)" width="1.98" x="346.5" y="44.10000000000002"></rect>
<path d="M 214.44 62.58000000000004 L 214.5 62.75999999999999 L 214.62 62.940000000000055 C 215.285 63.596000000000004 216.466 63.145000000000095 216.35999999999999 62.16000000000008L 216.3 61.92000000000007 L 216.24 61.74000000000001 L 216.12 61.620000000000005 L 216.0 61.440000000000055 L 215.82 61.379999999999995 L 215.64 61.32000000000005 L 215.46 61.25999999999999 L 215.28 61.25999999999999 L 215.04 61.32000000000005 C 214.69899999999998 61.40300000000002 214.527 61.69100000000003 214.38 61.98000000000002L 214.38 62.40000000000009 L 214.44 62.58000000000004" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 215.4 62.22000000000003 L 216.72 66.30000000000007 L 216.84 66.96000000000004 L 216.24 67.01999999999998 L 200.70000000000002 67.68000000000006 L 198.96 67.74000000000001 L 200.4 66.72000000000003 L 213.24 57.89999999999998 L 213.78 57.54000000000008 L 214.02 58.139999999999986 L 213.78 58.74000000000001 L 200.94 67.56000000000006 L 200.4 66.72000000000003 L 200.64000000000001 66.66000000000008 L 216.18 66.0 L 216.24 67.01999999999998 L 215.70000000000002 66.66000000000008 L 214.38 62.58000000000004" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 214.02 58.139999999999986 L 215.4 62.22000000000003 L 214.38000000000002 62.58000000000004 L 213.0 58.5" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 214.92000000000002 62.39999999999998 L 216.24 66.48000000000002 L 200.70000000000002 67.13999999999999 L 213.54000000000002 58.319999999999936" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 270.12 45.06000000000006 L 269.52 43.200000000000045 L 215.1 61.38000000000011 L 215.7 63.24000000000001" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 366.24 62.34000000000003 L 366.3 62.51999999999998 L 366.42 62.700000000000045 L 366.6 62.82000000000005 L 366.72 62.940000000000055 L 366.90000000000003 63.0 L 367.32 63.0 L 367.5 62.940000000000055 L 367.68 62.879999999999995 L 367.86 62.75999999999999 L 367.98 62.58000000000004 L 368.1 62.460000000000036 L 368.16 62.280000000000086 L 368.16 61.860000000000014 L 368.04 61.5 C 367.54 60.591999999999985 366.145 61.06299999999999 366.18 61.92000000000007L 366.18 62.16000000000008 L 366.24 62.34000000000003" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 367.20000000000005 61.98000000000002 L 368.58000000000004 66.06000000000006 L 368.70000000000005 66.72000000000003 L 368.1 66.77999999999997 L 352.56000000000006 67.68000000000006 L 350.82000000000005 67.74000000000001 L 352.26000000000005 66.72000000000003 L 364.98 57.72000000000003 L 365.52000000000004 57.360000000000014 L 365.76000000000005 57.960000000000036 L 365.58000000000004 58.56000000000006 L 352.86000000000007 67.56000000000006 L 352.26000000000005 66.72000000000003 L 352.50000000000006 66.65999999999997 L 368.04 65.75999999999999 L 368.1 66.77999999999997 L 367.62000000000006 66.42000000000007 L 366.24000000000007 62.34000000000003" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 365.76 57.960000000000036 L 367.2 61.98000000000002 L 366.24 62.34000000000003 L 364.74 58.32000000000005" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<path d="M 366.72 62.15999999999997 L 368.1 66.24000000000001 L 352.56 67.13999999999999 L 365.28000000000003 58.139999999999986" style="fill: rgb(0%, 0%, 0%); fill-rule: evenodd"></path>
<path d="M 418.68 45.06000000000006 L 418.02 43.200000000000045 L 366.9 61.1400000000001 L 367.56 63.000000000000114" style="fill: rgb(0%, 0%, 0%); fill-rule: nonzero"></path>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.17216670000002" x="197.70000000000002" y="10.350897799999984">X3</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.172166699999991" x="271.92" y="10.350897799999984">X2</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.172166699999991" x="346.20000000000005" y="10.350897799999984">X1</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.172166699999991" x="420.42" y="10.350897799999984">X0</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="20.028724720000014" x="141.84035448" y="11.971200820000035">SRC1</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.17216670000002" x="197.70000000000002" y="40.7108978">Y3</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.172166699999991" x="271.92" y="40.7108978">Y2</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.172166699999991" x="346.20000000000005" y="40.7108978">Y1</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="9.172166699999991" x="420.42" y="40.7108978">Y0</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="19.970668259999997" x="141.60121191999997" y="42.33120082000005">SRC2</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="70.60718964000003" x="141.60100483999997" y="77.85089779999998">DEST Y2 + Y3</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="26.87787904000004" x="259.68" y="77.85089779999998">X2 + X3</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="26.748194479999995" x="333.96" y="77.85089779999998">Y0 + Y1</text>
<text lengthAdjust="spacingAndGlyphs" style="font-size: 8.414416800000026pt; fill: #000" textLength="26.87787904000004" x="408.24" y="77.85089779999998">X0 + X1</text></g></svg>
<figcaption><a href='haddpd.html#fig-3-18'>Figure 3-18</a>. VHADDPD Operation</figcaption></figure>
<p>128-bit Legacy SSE version: The second source can be an XMM register or an 128-bit memory location. The destination is not distinct from the first source XMM register and the upper bits (MAXVL-1:128) of the corresponding YMM register destination are unmodified.</p>
<p>VEX.128 encoded version: the first source operand is an XMM register or 128-bit memory location. The destination operand is an XMM register. The upper bits (MAXVL-1:128) of the corresponding YMM register destination are zeroed.</p>
<p>VEX.256 encoded version: The first source operand is a YMM register. The second source operand can be a YMM register or a 256-bit memory location. The destination operand is a YMM register.</p>
<h2 id="operation">Operation<a class="anchor" href="#operation">
</a></h2>
<h3 id="haddpd--128-bit-legacy-sse-version-">HADDPD (128-bit Legacy SSE Version)<a class="anchor" href="#haddpd--128-bit-legacy-sse-version-">
</a></h3>
<pre>DEST[63:0] := SRC1[127:64] + SRC1[63:0]
DEST[127:64] := SRC2[127:64] + SRC2[63:0]
DEST[MAXVL-1:128] (Unmodified)
</pre>
<h3 id="vhaddpd--vex-128-encoded-version-">VHADDPD (VEX.128 Encoded Version)<a class="anchor" href="#vhaddpd--vex-128-encoded-version-">
</a></h3>
<pre>DEST[63:0] := SRC1[127:64] + SRC1[63:0]
DEST[127:64] := SRC2[127:64] + SRC2[63:0]
DEST[MAXVL-1:128] := 0
</pre>
<h3 id="vhaddpd--vex-256-encoded-version-">VHADDPD (VEX.256 Encoded Version)<a class="anchor" href="#vhaddpd--vex-256-encoded-version-">
</a></h3>
<pre>DEST[63:0] := SRC1[127:64] + SRC1[63:0]
DEST[127:64] := SRC2[127:64] + SRC2[63:0]
DEST[191:128] := SRC1[255:192] + SRC1[191:128]
DEST[255:192] := SRC2[255:192] + SRC2[191:128]
</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>VHADDPD __m256d _mm256_hadd_pd (__m256d a, __m256d b);
</pre>
<pre>HADDPD __m128d _mm_hadd_pd (__m128d a, __m128d b);
</pre>
<h2 class="exceptions" id="exceptions">Exceptions<a class="anchor" href="#exceptions">
</a></h2>
<p>When the source operand is a memory operand, the operand must be aligned on a 16-byte boundary or a general-protection exception (#GP) will be generated.</p>
<h2 class="exceptions" id="numeric-exceptions">Numeric Exceptions<a class="anchor" href="#numeric-exceptions">
</a></h2>
<p>Overflow, Underflow, Invalid, Precision, Denormal.</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-19</span>, “Type 2 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 Developers Manual</a> for anything serious.
</p></footer></body></html>