[llvm-bugs] [Bug 42197] New: Canonicalize OR with operands which do not have shared bits to ADD
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jun 8 15:01:35 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42197
Bug ID: 42197
Summary: Canonicalize OR with operands which do not have shared
bits to ADD
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
typedef unsigned char byte;
byte add_no_common_bits(byte x, byte y) {
// hint, no common bits
__builtin_assume((x & y) == 0);
return x | y;
}
byte or_no_common_bits(byte x, byte y) {
// hint, no common bits
__builtin_assume((x & y) == 0);
return x + y;
}
add_no_common_bits(unsigned char, unsigned char):
mov eax, edi
or eax, esi
ret
or_no_common_bits(unsigned char, unsigned char):
lea eax, [rsi + rdi]
ret
If we can prove that there are no shared bits between X and Y, maybe we could
turn OR to ADD.
Or ADD to OR.. not sure which form is better.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190608/456fffed/attachment.html>
More information about the llvm-bugs
mailing list