<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - ARM64: Fused left shift with a right shift can create NaNs from integers"
href="https://bugs.webkit.org/show_bug.cgi?id=160329">160329</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ARM64: Fused left shift with a right shift can create NaNs from integers
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>msaboff@apple.com
</td>
</tr></table>
<p>
<div>
<pre>The function
function signExtendByte(x) {
return x << 24 >> 24;
}
Generates the wrong instructions when compiled with the FTL JIT. The shift left / shift right combination becomes a sign extend, which is fine except it sign extends to a 64 bit value and not a 32 bit value.
Here is the code that the FTL generates for “x << 24 >> 24” (with my comments):
0x10695fdd8: ldur x0, [fp, #48] ; Load x_0
0x10695fddc: mov x1, #0xffff000000000000.; materialize tag
0x10695fde0: cmp x0, x1 ; Check for int
0x10695fde4: b.lo 0x10695feac
0x10695fde8: sxtb x0, w0 ; sign extend byte to 64 bits (oops should be 32 bits)
0x10695fdec: add x0, x0, x1 ; Add in tag
The sxtb x0, w0 should be a sxtb w0, w0.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>