<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style/style.css" />
<title>FABS: Absolute Value (x86 Instruction Set Reference)</title>
</head>
<body>
<div class="main_container"><h1>x86 Instruction Set Reference</h1>
<title>FABS: Absolute Value (x86 Instruction Set Reference)</title>
<h1>FABS</h1>
<h2>Absolute Value</h2>
<object>
<table class="box">
<tr>
<th>Opcode</th>
<th>Mnemonic</th>
<th>Description</th>
</tr>
<tr>
<td class="grid"><code>D9 E1</code></td>
<td class="grid"><code>FABS</code></td>
<td class="grid">Replace ST with its absolute value.</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Description</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<p>Clears the sign bit of ST(0) to create the absolute value of the operand. The following table shows the results obtained when creating the absolute value of various classes of numbers.</p>
<div>
<table class="grid">
<caption>Results Obtained from FABS</caption>
<tr><th>ST(0) Source</th><th>ST(0) Destination</th></tr>
<tr><td>-inf</td><td>+inf</td></tr>
<tr><td>-F</td><td>+F</td></tr>
<tr><td>-0</td><td>+0</td></tr>
<tr><td>+0</td><td>+0</td></tr>
<tr><td>+F</td><td>+F</td></tr>
<tr><td>+inf</td><td>+inf</td></tr>
<tr><td>NaN</td><td>NaN</td></tr>
<tfoot>
<tr><td colspan="2">NOTE: F Means finite floating-point value.</td></tr>
</tfoot>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Operation</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<pre>ST<span class="operator">(</span><span class="number">0</span><span class="operator">)</span> <span class="operator">=</span> GetAbsoluteValue<span class="operator">(</span>ST<span class="operator">(</span><span class="number">0</span><span class="operator">)</span><span class="operator">)</span><span class="operator">;</span>
</pre>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>FPU flags affected</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<p>C1 Set to 0 if stack underflow occurred; otherwise, set to 0.
C0, C2, C3 Undefined.
</p>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Floating-Point Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#IS</code></td><td>Stack underflow occurred.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Protected Mode Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#NM</code></td><td>EM or TS in CR0 is set.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Real-Address Mode Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#NM</code></td><td>EM or TS in CR0 is set.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Virtual-8086 Mode Exceptions</th>
</tr>
<tr>
<td class="instruction_set_reference_box">
<div>
<table class="operations_table">
<tr><td><code>#NM</code></td><td>EM or TS in CR0 is set.</td></tr>
</table>
</div>
</td>
</tr>
</table>
</object>
<object>
<table class="box">
<tr>
<th>Instruction</th>
<th>Latency</th>
<th>Throughput</th>
<th>Execution Unit</th>
</tr>
<tr><td class="grid"><code>CPUID</code></td><td class="grid">0F3n/0F2n</td><td class="grid">0F3n/0F2n</td><td class="grid">0F2n</td></tr>
<tr><td class="grid"><code>FABS</code></td><td class="grid">3/2</td><td class="grid">1/1</td><td class="grid">FP_MISC</td></tr>
</table>
</object>
</div>
</body>
</html>
