<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55201>55201</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
likely arm64 miscompile
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
regehr
</td>
</tr>
</table>
<pre>
ok this has been llvm-reduced but it's still a bit complex, sorry!
```llvm
define i32 @f(i32 %x) {
%or1 = or i32 %x, 1
%sh1 = shl i32 %or1, 5
%sh2 = lshr i32 %x, 27
%1 = and i32 %sh2, 1
%r = or i32 %sh1, %1
ret i32 %r
}
```
we believe that `f(0xf0000000) -> 32` and that is what we get when using global isel, and also when compiling this code for x64.
on the other hand, the default arm64 backend from top of tree gives `f(0xf0000000) -> 62`
we don't think there's any UB going on here, seems like a straight-up miscompile
cc @ornata @nunoplopes @ryan-berger @nbushehri @aqjune
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U1tyozAQPI34mbJLCPDjg48k3txgDyBgAMVCYvWI7dvvCOyKk61aigKhaU339AyN7W61PUMYlYdRemgQDWj9OW0cdrHFDpoYQAUm9h58UFqDhEYFaO00a7wy8QbeOndjImf8xPjL_bnj651yrVsd9sogqEIAK3nPxGFZioqSHIHtX1cYpC3rcmDFCayDL9Ab5E8QP64QP-oHhk4lVPUNJRaU9uP3VGL_hFozSdM9IHTsJ5_7IYj4EySdfqAchkfU3W3Yn3748WzSBclvrfATqQEyAIWTLfza8_VKxmxY8QsKQbFF4AKkZl3SmxIMxHkZqWnRKzPAoG0jyRCPOqlLJ6T2doWknimdYEu_W9sh9FTRdVdun3VZQwAESw9HU2G6lCrtUAtl1AGkm3YlNLI9IxH0zk4Q7Ay2h-CQNKlP9P-pZif-NaKzhmYsJGUmzSM6XGZOmhv8foXBJtkkbA3Q0CFOHrQ6Iw2kD06qYQybOMOk_FonPjO0bRo664wMMq1MNHbWdk46S-5u0mwadAPVm4JN9COOTqUP-ecjGsy6uuiOxVFmQQWNdSLWt7sRX5RZdLoeQ5g9K16YeKd7UGGMzZYA9LH8DetrMzv7gS39We_K-4ieFlUleJ6NtRRNvzvsec5b5KU8tIeu3EsuhRCVyI95piUNjq9Z9cqEMHiBJQWtWXXKVC24ELwsOC9KzvNtVR4qnstd3tBVHHuqCiep9Dbp2Fo3ZK5eJDVx8BTUygf_FZTeq8EgLnSUX8YwWlc7HMijbGGuF-V_AXGhReU">