<html>
<head>
<base href="https://bugs.llvm.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 - `and 0xff` on load of 1 byte"
href="https://bugs.llvm.org/show_bug.cgi?id=51317">51317</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>`and 0xff` on load of 1 byte
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: AArch64
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kutdanila@yandex.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
</td>
</tr></table>
<p>
<div>
<pre>Minimal example <a href="https://gcc.godbolt.org/z/z8GrK6v95">https://gcc.godbolt.org/z/z8GrK6v95</a>
DecompressBranchless
ldrb w8, [x0], #1
.LBB0_1: // =>This Inner Loop Header: Depth=1
and x9, x8, #0xff // Redundant!!!!!!!!!
ldrh w11, [x5, x9, lsl #1]
ubfx x10, x8, #2, #6
ands x8, x8, #0x3
csinc x8, x8, x10, ne
add x10, x2, x11
add x9, x0, x8
add x11, x3, x10
ldrb w8, [x9], #1
csel x11, x0, x11, eq
ldrb w11, [x11]
cmp x9, x1
strb w11, [x3, x2]
b.hs .LBB0_3
cmp x10, x4
mov x0, x9
mov x2, x10
b.lt .LBB0_1
.LBB0_3:
ret
After adding `asm("" ::"r"(tag));`, and is removed
DecompressBranchlessBetter
ldrb w8, [x0], #1
.LBB1_1: // =>This Inner Loop Header: Depth=1
ldrh w10, [x5, x8, lsl #1]
lsr x9, x8, #2
ands x8, x8, #0x3
csinc x8, x8, x9, ne
add x10, x2, x10
add x9, x0, x8
add x11, x3, x10
ldrb w8, [x9], #1
csel x11, x0, x11, eq
ldrb w11, [x11]
cmp x9, x1
strb w11, [x3, x2]
b.hs .LBB1_3
cmp x10, x4
mov x0, x9
mov x2, x10
b.lt .LBB1_1
.LBB1_3:
ret</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>