https://bugs.llvm.org/show_bug.cgi?id=46955
Bug ID: 46955
Summary: Missed simplification (A|C)^(B|C) ->
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@lists.llvm.org
#define C 4
unsigned int test(unsigned int A, unsigned int B, unsigned int CC)
{
return (A|C)^(B|C);
}
unsigned int test2(unsigned int A, unsigned int B, unsigned int CC)
{
return (A^B)&~C;
}
Clang
test(unsigned int, unsigned int, unsigned int): #
@test(unsigned int, unsigned int, unsigned int)
mov eax, esi
or edi, 4
or eax, 4
xor eax, edi
ret
test2(unsigned int, unsigned int, unsigned int): #
@test2(unsigned int, unsigned int, unsigned int)
mov eax, edi
xor eax, esi
and eax, -5
ret
GCC
test(unsigned int, unsigned int, unsigned int):
xor esi, edi
mov eax, esi
and eax, -5
ret
test2(unsigned int, unsigned int, unsigned int):
xor edi, esi
mov eax, edi
and eax, -5
ret
https://godbolt.org/z/3McGvb
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs