blob: fb2cbf4e70cfd1780929d2e9f2f6b5b329c42e73 [file] [log] [blame] [raw]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>PSRAW/PSRAD—Shift Packed Data Right Arithmetic </title></head>
<body>
<h1>PSRAW/PSRAD—Shift Packed Data Right Arithmetic</h1>
<table>
<tr>
<th>Description</th>
<th>CPUID Feature Flag</th>
<th>Opcode/Instruction</th>
<th>Op/En</th>
<th>64/32 bit Mode Support</th></tr>
<tr>
<td>Shift words in <em>mm</em> right by <em>mm/m64</em> while shifting in sign bits.</td>
<td>MMX</td>
<td>
<p>0F E1 /<em>r</em><sup>1</sup></p>
<p>PSRAW <em>mm, mm/m64</em></p></td>
<td>RM</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>xmm1</em> right by <em>xmm2/m128 </em>while shifting in sign bits.</td>
<td>SSE2</td>
<td>
<p>66 0F E1 /<em>r</em></p>
<p>PSRAW <em>xmm1</em>, <em>xmm2/m128</em></p></td>
<td>RM</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>mm</em> right by <em>imm8</em> while shifting in sign bits</td>
<td>MMX</td>
<td>
<p>0F 71 /4 ib<sup>1</sup></p>
<p>PSRAW <em>mm, imm8</em></p></td>
<td>MI</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>xmm1</em> right by imm8 while shifting in sign bits</td>
<td>SSE2</td>
<td>
<p>66 0F 71 /4 ib</p>
<p>PSRAW <em>xmm1</em>, imm8</p></td>
<td>MI</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>mm</em> right by <em>mm/m64 </em>while shifting in sign bits.</td>
<td>MMX</td>
<td>
<p>0F E2 /<em>r</em><sup>1</sup></p>
<p>PSRAD <em>mm, mm/m64</em></p></td>
<td>RM</td>
<td>V/V</td></tr>
<tr>
<td>Shift doubleword in <em>xmm1</em> right by <em>xmm2 /m128 </em>while shifting in sign bits.</td>
<td>SSE2</td>
<td>
<p>66 0F E2 /<em>r</em></p>
<p>PSRAD <em>xmm1</em>, <em>xmm2/m128</em></p></td>
<td>RM</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>mm</em> right by <em>imm8</em> while shifting in sign bits.</td>
<td>MMX</td>
<td>
<p>0F 72 /4 ib<sup>1</sup></p>
<p>PSRAD <em>mm, imm8</em></p></td>
<td>MI</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>xmm1</em> right by <em>imm8 </em>while shifting in sign bits.</td>
<td>SSE2</td>
<td>
<p>66 0F 72 /4 ib</p>
<p>PSRAD <em>xmm1</em>, imm8</p></td>
<td>MI</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>xmm2</em> right by amount specified in <em>xmm3/m128</em> while shifting in sign bits.</td>
<td>AVX</td>
<td>
<p>VEX.NDS.128.66.0F.WIG E1 /r</p>
<p>VPSRAW <em>xmm1, xmm2, xmm3/m128</em></p></td>
<td>RVM</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>xmm2</em> right by <em>imm8</em> while shifting in sign bits.</td>
<td>AVX</td>
<td>
<p>VEX.NDD.128.66.0F.WIG 71 /4 ib</p>
<p>VPSRAW <em>xmm1, xmm2, imm8</em></p></td>
<td>VMI</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>xmm2</em> right by amount specified in <em>xmm3/m128</em> while shifting in sign bits.</td>
<td>AVX</td>
<td>
<p>VEX.NDS.128.66.0F.WIG E2 /r</p>
<p>VPSRAD <em>xmm1, xmm2, xmm3/m128</em></p></td>
<td>RVM</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>xmm2</em> right by <em>imm8 </em>while shifting in sign bits.</td>
<td>AVX</td>
<td>
<p>VEX.NDD.128.66.0F.WIG 72 /4 ib</p>
<p>VPSRAD <em>xmm1, xmm2, imm8</em></p></td>
<td>VMI</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>ymm2</em> right by amount specified in <em>xmm3/m128</em> while shifting in sign bits.</td>
<td>AVX2</td>
<td>
<p>VEX.NDS.256.66.0F.WIG E1 /r</p>
<p>VPSRAW <em>ymm1, ymm2, xmm3/m128</em></p></td>
<td>RVM</td>
<td>V/V</td></tr>
<tr>
<td>Shift words in <em>ymm2 </em>right by <em>imm8</em> while shifting in sign bits.</td>
<td>AVX2</td>
<td>
<p>VEX.NDD.256.66.0F.WIG 71 /4 ib</p>
<p>VPSRAW <em>ymm1, ymm2, imm8</em></p></td>
<td>VMI</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>ymm2</em> right by amount specified in <em>xmm3/m128</em> while shifting in sign bits.</td>
<td>AVX2</td>
<td>
<p>VEX.NDS.256.66.0F.WIG E2 /r</p>
<p>VPSRAD <em>ymm1, ymm2, xmm3/m128</em></p></td>
<td>RVM</td>
<td>V/V</td></tr>
<tr>
<td>Shift doublewords in <em>ymm2</em> right by <em>imm8 </em>while shifting in sign bits.</td>
<td>AVX2</td>
<td>
<p>VEX.NDD.256.66.0F.WIG 72 /4 ib</p>
<p>VPSRAD <em>ymm1, ymm2, imm8</em></p></td>
<td>VMI</td>
<td>V/V</td></tr></table>
<p>NOTES:</p>
<p>1. See note in Section 2.4, “Instruction Exception Specification” in the <em>Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 2A</em> and Section 22.25.3, “Exception Conditions of Legacy SIMD Instructions Operating on MMX Registers” in the <em>Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 3A</em>.</p>
<h3>Instruction Operand Encoding</h3>
<table>
<tr>
<td>Op/En</td>
<td>Operand 1</td>
<td>Operand 2</td>
<td>Operand 3</td>
<td>Operand 4</td></tr>
<tr>
<td>RM</td>
<td>ModRM:reg (r, w)</td>
<td>ModRM:r/m (r)</td>
<td>NA</td>
<td>NA</td></tr>
<tr>
<td>MI</td>
<td>ModRM:r/m (r, w)</td>
<td>imm8</td>
<td>NA</td>
<td>NA</td></tr>
<tr>
<td>RVM</td>
<td>ModRM:reg (w)</td>
<td>VEX.vvvv (r)</td>
<td>ModRM:r/m (r)</td>
<td>NA</td></tr>
<tr>
<td>VMI</td>
<td>VEX.vvvv (w)</td>
<td>ModRM:r/m (r)</td>
<td>imm8</td>
<td>NA</td></tr></table>
<h2>Description</h2>
<p>Shifts the bits in the individual data elements (words or doublewords) in the destination operand (first operand) to the right by the number of bits specified in the count operand (second operand). As the bits in the data elements are shifted right, the empty high-order bits are filled with the initial value of the sign bit of the data element. If the value specified by the count operand is greater than 15 (for words) or 31 (for doublewords), each destination data element is filled with the initial value of the sign bit of the element. (Figure 4-14 gives an example of shifting words in a 64-bit operand.)</p>
<svg width="568.799985" viewBox="111.840000 644963.999980 379.199990 104.760015" height="157.1400225">
<text y="644982.827484" x="159.5399" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="31.008684">Pre-Shift</text>
<text y="644991.107484" x="170.04" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="21.320964">DEST</text>
<text y="645004.705488" x="158.46" style="font-size:6.960000pt" lengthAdjust="spacingAndGlyphs" textLength="31.41744">Shift Right</text>
<text y="645011.965488" x="162.54" style="font-size:6.960000pt" lengthAdjust="spacingAndGlyphs" textLength="27.528192">with Sign</text>
<text y="645019.765588" x="160.6197" style="font-size:6.960000pt" lengthAdjust="spacingAndGlyphs" textLength="29.386512">Extension</text>
<text y="645035.687784" x="154.7399" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="34.539834">Post-Shift</text>
<text y="645043.667484" x="169.02" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="21.315378">DEST</text>
<rect y="644975.16" x="319.98" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.88"></rect>
<rect y="644975.16" x="382.86" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.88"></rect>
<rect y="645028.14" x="193.62" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.88"></rect>
<rect y="645028.14" x="256.5" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.88"></rect>
<rect y="645028.14" x="319.38" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.88"></rect>
<rect y="644975.16" x="194.16" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.88"></rect>
<rect y="644975.16" x="257.04" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.94"></rect>
<rect y="645028.14" x="382.26" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="62.94"></rect>
<path style="stroke:black" d="M193.920000,644974.920000 L193.920000,644993.160000 L194.400000,644993.160000 L194.400000,644974.920000 "></path>
<path style="stroke:black" d="M256.800000,644974.920000 L256.800000,644993.160000 L257.280010,644993.160000 L257.280010,644974.920000 "></path>
<path style="stroke:black" d="M319.740000,644974.920000 L319.740000,644993.160000 L320.220010,644993.160000 L320.220010,644974.920000 "></path>
<path style="stroke:black" d="M382.620000,644974.920000 L382.620000,644993.160000 L383.100010,644993.160000 L383.100010,644974.920000 "></path>
<path style="stroke:black" d="M194.160000,644974.920020 L194.160000,644975.400000 L257.280000,644975.400000 L257.280000,644974.920020 "></path>
<path style="stroke:black" d="M257.040000,644974.920020 L257.040000,644975.400000 L320.220000,644975.400000 L320.220000,644974.920020 "></path>
<path style="stroke:black" d="M319.980000,644974.920020 L319.980000,644975.400000 L383.100000,644975.400000 L383.100000,644974.920020 "></path>
<path style="stroke:black" d="M382.860000,644974.920020 L382.860000,644975.400000 L445.980000,644975.400000 L445.980000,644974.920020 "></path>
<path style="stroke:black" d="M256.800000,644975.160000 L256.800000,644993.400000 L257.280010,644993.400000 L257.280010,644975.160000 "></path>
<path style="stroke:black" d="M319.740000,644975.160000 L319.740000,644993.400000 L320.220010,644993.400000 L320.220010,644975.160000 "></path>
<path style="stroke:black" d="M382.620000,644975.160000 L382.620000,644993.400000 L383.100010,644993.400000 L383.100010,644975.160000 "></path>
<path style="stroke:black" d="M445.500000,644975.160000 L445.500000,644993.400000 L445.980010,644993.400000 L445.980010,644975.160000 "></path>
<path style="stroke:black" d="M193.920000,644992.920020 L193.920000,644993.400000 L257.040000,644993.400000 L257.040000,644992.920020 "></path>
<path style="stroke:black" d="M256.800000,644992.920020 L256.800000,644993.400000 L319.980000,644993.400000 L319.980000,644992.920020 "></path>
<path style="stroke:black" d="M319.740000,644992.920020 L319.740000,644993.400000 L382.860000,644993.400000 L382.860000,644992.920020 "></path>
<path style="stroke:black" d="M382.620000,644992.920020 L382.620000,644993.400000 L445.740000,644993.400000 L445.740000,644992.920020 "></path>
<path style="stroke:black" d="M275.820000,644993.280000 L275.820000,645008.220000 L276.299980,645008.220000 L276.299980,644993.280000 "></path>
<path style="stroke:black" d="M212.100000,644993.340000 L212.100000,645008.280000 L212.580010,645008.280000 L212.580010,644993.340000 "></path>
<path style="stroke:black" d="M394.320000,644993.340000 L394.320000,645008.280000 L394.800010,645008.280000 L394.800010,644993.340000 "></path>
<path style="stroke:black" d="M332.580000,644993.820000 L332.580000,645008.760000 L333.060010,645008.760000 L333.060010,644993.820000 "></path>
<path style="stroke:black" d="M276.060000,645007.739990 L276.060000,645008.220000 L302.040000,645008.220000 L302.040000,645007.739990 "></path>
<path style="stroke:black" d="M212.340000,645007.799990 L212.340000,645008.280000 L238.320000,645008.280000 L238.320000,645007.799990 "></path>
<path style="stroke:black" d="M394.560000,645007.799990 L394.560000,645008.280000 L420.480000,645008.280000 L420.480000,645007.799990 "></path>
<path style="stroke:black" d="M301.560000,645007.980000 L301.560000,645020.880000 L302.040010,645020.880000 L302.040010,645007.980000 "></path>
<path style="stroke:black" d="M237.840000,645008.040000 L237.840000,645020.940000 L238.320000,645020.940000 L238.320000,645008.040000 "></path>
<path style="stroke:black" d="M420.000000,645008.040000 L420.000000,645021.000000 L420.480010,645021.000000 L420.480010,645008.040000 "></path>
<path style="stroke:black" d="M332.820000,645008.280020 L332.820000,645008.760000 L358.800000,645008.760000 L358.800000,645008.280020 "></path>
<path style="stroke:black" d="M358.320000,645008.520000 L358.320000,645021.420000 L358.800010,645021.420000 L358.800010,645008.520000 "></path>
<path style="stroke:black" d="M237.900000,645021.300000 L239.460000,645020.700000 L240.420000,645020.340000 L240.120000,645021.360000 L238.560000,645026.760000 L238.080000,645028.440000 L237.600000,645026.760000 L236.040000,645021.360000 L235.740000,645020.340000 L236.700000,645020.700000 L237.000000,645021.060000 L238.560000,645026.460000 L237.600000,645026.760000 L237.600000,645026.460000 L239.160000,645021.060000 L240.120000,645021.360000 L239.820000,645021.660000 L238.260000,645022.260000 "></path>
<path style="stroke:black" d="M301.620000,645021.240000 L303.180000,645020.700000 L304.140000,645020.340000 L303.840000,645021.360000 L302.280000,645026.700000 L301.800000,645028.320000 L301.320000,645026.700000 L299.760000,645021.360000 L299.460000,645020.340000 L300.420000,645020.700000 L300.720000,645021.060000 L302.280000,645026.400000 L301.320000,645026.700000 L301.320000,645026.400000 L302.880000,645021.060000 L303.840000,645021.360000 L303.540000,645021.660000 L301.980000,645022.200000 "></path>
<path style="stroke:black" d="M420.060000,645021.300000 L421.620000,645020.760000 L422.580000,645020.400000 L422.280000,645021.420000 L420.720000,645026.820000 L420.240000,645028.560000 L419.760000,645026.820000 L418.260000,645021.420000 L417.960000,645020.400000 L418.920000,645020.760000 L419.220000,645021.120000 L420.720000,645026.520000 L419.760000,645026.820000 L419.760000,645026.520000 L421.320000,645021.120000 L422.280000,645021.420000 L421.980000,645021.720000 L420.420000,645022.260000 "></path>
<path style="stroke:black" d="M301.560000,645020.640000 L301.560000,645021.720000 L302.040010,645021.720000 L302.040010,645020.640000 "></path>
<path style="stroke:black" d="M236.700000,645020.700000 L238.260000,645021.300000 L238.260000,645022.260000 L238.080000,645022.320000 L237.900000,645022.260000 L236.340000,645021.660000 "></path>
<path style="stroke:black" d="M237.840000,645020.700000 L237.840000,645021.780000 L238.320000,645021.780000 L238.320000,645020.700000 "></path>
<path style="stroke:black" d="M300.420000,645020.700000 L301.980000,645021.240000 L301.980000,645022.200000 L301.800000,645022.260000 L301.620000,645022.200000 L300.060000,645021.660000 "></path>
<path style="stroke:black" d="M358.380000,645021.720000 L359.880000,645021.180000 L360.840000,645020.760000 L359.040000,645027.240000 L358.560000,645028.920000 L358.080000,645027.240000 L356.520000,645021.840000 L356.220000,645020.820000 L357.180000,645021.180000 L357.480000,645021.540000 L359.040000,645026.940000 L358.080000,645027.240000 L358.080000,645026.940000 L359.580000,645021.540000 L360.540000,645021.840000 L360.240000,645022.140000 L358.740000,645022.680000 "></path>
<path style="stroke:black" d="M418.920000,645020.760000 L420.420000,645021.300000 L420.420000,645022.260000 L420.240000,645022.320000 L420.060000,645022.260000 L418.560000,645021.720000 "></path>
<path style="stroke:black" d="M420.000000,645020.760000 L420.000000,645021.780000 L420.480010,645021.780000 L420.480010,645020.760000 "></path>
<path style="stroke:black" d="M238.080000,645021.780000 L239.640000,645021.180000 L238.080000,645026.580000 L236.520000,645021.180000 "></path>
<path style="stroke:black" d="M301.800000,645021.720000 L303.360000,645021.180000 L301.800000,645026.520000 L300.240000,645021.180000 "></path>
<path style="stroke:black" d="M357.180000,645021.180000 L358.740000,645021.720000 L358.740000,645022.680000 L358.560000,645022.740000 L358.380000,645022.680000 L356.820000,645022.140000 "></path>
<path style="stroke:black" d="M358.320000,645021.180000 L358.320000,645022.200000 L358.800010,645022.200000 L358.800010,645021.180000 "></path>
<path style="stroke:black" d="M420.240000,645021.780000 L421.800000,645021.240000 L420.240000,645026.640000 L418.740000,645021.240000 "></path>
<path style="stroke:black" d="M358.560000,645022.200000 L360.060000,645021.660000 L358.560000,645027.060000 L357.000000,645021.660000 "></path>
<path style="stroke:black" d="M193.620000,645027.899990 L193.620000,645028.380000 L256.740000,645028.380000 L256.740000,645027.899990 "></path>
<path style="stroke:black" d="M256.500000,645027.899990 L256.500000,645028.380000 L319.620000,645028.380000 L319.620000,645027.899990 "></path>
<path style="stroke:black" d="M319.380000,645027.899990 L319.380000,645028.380000 L382.500000,645028.380000 L382.500000,645027.899990 "></path>
<path style="stroke:black" d="M382.260000,645027.899990 L382.260000,645028.380000 L445.440000,645028.380000 L445.440000,645027.899990 "></path>
<path style="stroke:black" d="M193.380000,645027.900000 L193.380000,645046.140000 L193.860010,645046.140000 L193.860010,645027.900000 "></path>
<path style="stroke:black" d="M256.260000,645027.900000 L256.260000,645046.140000 L256.739980,645046.140000 L256.739980,645027.900000 "></path>
<path style="stroke:black" d="M319.140000,645027.900000 L319.140000,645046.140000 L319.619980,645046.140000 L319.619980,645027.900000 "></path>
<path style="stroke:black" d="M382.020000,645027.900000 L382.020000,645046.140000 L382.500010,645046.140000 L382.500010,645027.900000 "></path>
<path style="stroke:black" d="M256.260000,645028.140000 L256.260000,645046.380000 L256.739980,645046.380000 L256.739980,645028.140000 "></path>
<path style="stroke:black" d="M319.140000,645028.140000 L319.140000,645046.380000 L319.619980,645046.380000 L319.619980,645028.140000 "></path>
<path style="stroke:black" d="M382.020000,645028.140000 L382.020000,645046.380000 L382.500010,645046.380000 L382.500010,645028.140000 "></path>
<path style="stroke:black" d="M444.960000,645028.140000 L444.960000,645046.380000 L445.440010,645046.380000 L445.440010,645028.140000 "></path>
<path style="stroke:black" d="M193.380000,645045.899990 L193.380000,645046.380000 L256.500000,645046.380000 L256.500000,645045.899990 "></path>
<path style="stroke:black" d="M256.260000,645045.899990 L256.260000,645046.380000 L319.380000,645046.380000 L319.380000,645045.899990 "></path>
<path style="stroke:black" d="M319.140000,645045.899990 L319.140000,645046.380000 L382.260000,645046.380000 L382.260000,645045.899990 "></path>
<path style="stroke:black" d="M382.020000,645045.899990 L382.020000,645046.380000 L445.200000,645046.380000 L445.200000,645045.899990 "></path>
<text y="644986.907784" x="345.177424" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="9.777096">X1</text>
<text y="644986.907484" x="407.4" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="9.717246">X0</text>
<text y="645040.667484" x="198.3598" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="53.65532">X3 &gt;&gt; COUNT</text>
<text y="645040.667484" x="262.1402" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="53.59906">X2 &gt;&gt; COUNT</text>
<text y="645040.667484" x="325.4397" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="53.5836">X1 &gt;&gt; COUNT</text>
<text y="644986.907784" x="220.3798" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="9.777096">X3</text>
<text y="644986.907784" x="284.095312" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="9.777096">X2</text>
<text y="645040.667184" x="385.9801" style="font-size:7.980000pt" lengthAdjust="spacingAndGlyphs" textLength="11.997132">X0 &gt;&gt; COUNT</text></svg>
<h3>Figure 4-14. PSRAW and PSRAD Instruction Operation Using a 64-bit Operand</h3>
<p>Note that only the first 64-bits of a 128-bit count operand are checked to compute the count. If the second source operand is a memory address, 128 bits are loaded.</p>
<p>The (V)PSRAW instruction shifts each of the words in the destination operand to the right by the number of bits specified in the count operand, and the (V)PSRAD instruction shifts each of the doublewords in the destination operand.</p>
<p>In 64-bit mode, using a REX prefix in the form of REX.R permits this instruction to access additional registers (XMM8-XMM15).</p>
<p>Legacy SSE instructions: The destination operand is an MMX technology register; the count operand can be either an MMX technology register or an 64-bit memory location.</p>
<p>128-bit Legacy SSE version: The destination and first source operands are XMM registers. Bits (VLMAX-1:128) of the corresponding YMM destination register remain unchanged. The count operand can be either an XMM register or a 128-bit memory location or an 8-bit immediate. If the count operand is a memory address, 128 bits are loaded but the upper 64 bits are ignored.</p>
<p>VEX.128 encoded version: The destination and first source operands are XMM registers. Bits (VLMAX-1:128) of the destination YMM register are zeroed. The count operand can be either an XMM register or a 128-bit memory loca-tion or an 8-bit immediate. If the count operand is a memory address, 128 bits are loaded but the upper 64 bits are ignored.</p>
<p>VEX.256 encoded version: The destination and first source operands are YMM registers. The count operand can be either an XMM register or a 128-bit memory location or an 8-bit immediate.</p>
<p>Note: For shifts with an immediate count (VEX.128.66.0F 71-73 /4), VEX.vvvv encodes the destination register, and VEX.B + ModRM.r/m encodes the source register. VEX.L must be 0, otherwise instructions will #UD.</p>
<h2>Operation</h2>
<p><strong>PSRAW (with 64-bit operand)</strong></p>
<pre> IF (COUNT &gt; 15)
THEN COUNT ← 16;
FI;
DEST[15:0] ← SignExtend(DEST[15:0] &gt;&gt; COUNT);
(* Repeat shift operation for 2nd and 3rd words *)
DEST[63:48] ← SignExtend(DEST[63:48] &gt;&gt; COUNT);</pre>
<p><strong>PSRAD (with 64-bit operand)</strong></p>
<pre> IF (COUNT &gt; 31)
THEN COUNT ← 32;
FI;
DEST[31:0] ← SignExtend(DEST[31:0] &gt;&gt; COUNT);
DEST[63:32] ← SignExtend(DEST[63:32] &gt;&gt; COUNT);</pre>
<p><strong>PSRAW (with 128-bit operand)</strong></p>
<pre> COUNT ← COUNT_SOURCE[63:0];
IF (COUNT &gt; 15)
THEN COUNT ← 16;
FI;
DEST[15:0] ← SignExtend(DEST[15:0] &gt;&gt; COUNT);
(* Repeat shift operation for 2nd through 7th words *)
DEST[127:112] ← SignExtend(DEST[127:112] &gt;&gt; COUNT);</pre>
<p><strong>PSRAD (with 128-bit operand)</strong></p>
<pre> COUNT ← COUNT_SOURCE[63:0];
IF (COUNT &gt; 31)
THEN COUNT ← 32;
FI;
DEST[31:0] ← SignExtend(DEST[31:0] &gt;&gt; COUNT);
(* Repeat shift operation for 2nd and 3rd doublewords *)
DEST[127:96] ← SignExtend(DEST[127:96] &gt;&gt;COUNT);</pre>
<p><strong>PSRAW (xmm, xmm, xmm/m128)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_WORDS(DEST, SRC)
DEST[VLMAX-1:128] (Unmodified)</pre>
<p><strong>PSRAW (xmm, imm8)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_WORDS(DEST, imm8)
DEST[VLMAX-1:128] (Unmodified)</pre>
<p><strong>VPSRAW (xmm, xmm, xmm/m128)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_WORDS(SRC1, SRC2)
DEST[VLMAX-1:128] ← 0</pre>
<p><strong>VPSRAW (xmm, imm8)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_WORDS(SRC1, imm8)
DEST[VLMAX-1:128] ← 0</pre>
<p><strong>PSRAD (xmm, xmm, xmm/m128)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_DWORDS(DEST, SRC)
DEST[VLMAX-1:128] (Unmodified)</pre>
<p><strong>PSRAD (xmm, imm8)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_DWORDS(DEST, imm8)
DEST[VLMAX-1:128] (Unmodified)</pre>
<p><strong>VPSRAD (xmm, xmm, xmm/m128)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_DWORDS(SRC1, SRC2)
DEST[VLMAX-1:128] ← 0</pre>
<p><strong>VPSRAD (xmm, imm8)</strong></p>
<pre>DEST[127:0] ← ARITHMETIC_RIGHT_SHIFT_DWORDS(SRC1, imm8)
DEST[VLMAX-1:128] ← 0</pre>
<p><strong>VPSRAW (ymm, ymm, xmm/m128)</strong></p>
<pre>DEST[255:0] ← ARITHMETIC_RIGHT_SHIFT_WORDS_256b(SRC1, SRC2)</pre>
<p><strong>VPSRAW (ymm, imm8)</strong></p>
<pre>DEST[255:0] ← ARITHMETIC_RIGHT_SHIFT_WORDS_256b(SRC1, imm8)</pre>
<p><strong>VPSRAD (ymm, ymm, xmm/m128)</strong></p>
<pre>DEST[255:0] ← ARITHMETIC_RIGHT_SHIFT_DWORDS_256b(SRC1, SRC2)</pre>
<p><strong>VPSRAD (ymm, imm8)</strong></p>
<pre>DEST[255:0] ← ARITHMETIC_RIGHT_SHIFT_DWORDS_256b(SRC1, imm8)</pre>
<h2>Intel C/C++ Compiler Intrinsic Equivalents</h2>
<p>PSRAW:</p>
<p>__m64 _mm_srai_pi16 (__m64 m, int count)</p>
<p>PSRAW:</p>
<p>__m64 _mm_sra_pi16 (__m64 m, __m64 count)</p>
<p>(V)PSRAW:</p>
<p>__m128i _mm_srai_epi16(__m128i m, int count)</p>
<p>(V)PSRAW:</p>
<p>__m128i _mm_sra_epi16(__m128i m, __m128i count)</p>
<p>VPSRAW:</p>
<p>__m256i _mm256_srai_epi16 (__m256i m, int count)</p>
<p>VPSRAW:</p>
<p>__m256i _mm256_sra_epi16 (__m256i m, __m128i count)</p>
<p>PSRAD:</p>
<p>__m64 _mm_srai_pi32 (__m64 m, int count)</p>
<p>PSRAD:</p>
<p>__m64 _mm_sra_pi32 (__m64 m, __m64 count)</p>
<p>(V)PSRAD:</p>
<p>__m128i _mm_srai_epi32 (__m128i m, int count)</p>
<p>(V)PSRAD:</p>
<p>__m128i _mm_sra_epi32 (__m128i m, __m128i count)</p>
<p>VPSRAD:</p>
<p>__m256i _mm256_srai_epi32 (__m256i m, int count)</p>
<p>VPSRAD:</p>
<p>__m256i _mm256_sra_epi32 (__m256i m, __m128i count)</p>
<h2>Flags Affected</h2>
<p>None.</p>
<h2>Numeric Exceptions</h2>
<p>None.</p>
<h2>Other Exceptions</h2>
<p>See Exceptions Type 4 and 7 for non-VEX-encoded instructions; additionally</p>
<table class="exception-table">
<tr>
<td>#UD</td>
<td>If VEX.L = 1.</td></tr></table></body></html>