[llvm-bugs] [Bug 47191] New: Missing bswap
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Aug 16 14:57:49 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47191
Bug ID: 47191
Summary: Missing bswap
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
64-bit cases:
#include <stdint.h>
#include <cstddef>
uint64_t problem1(uint64_t input) {
return (((input & 0xFF00000000000000ULL) >> 56) +
((input & 0x00FF000000000000ULL) >> 40) +
((input & 0x0000FF0000000000ULL) >> 24) +
((input & 0x000000FF00000000ULL) >> 8) +
((input & 0x00000000000000FFULL) << 56) +
((input & 0x000000000000FF00ULL) << 40) +
((input & 0x0000000000FF0000ULL) << 24) +
((input & 0x00000000FF000000ULL) << 8));
}
uint64_t problem2(uint64_t input) {
return (((input >> 56) & 0x00000000000000FFULL) ^
((input >> 40) & 0x000000000000FF00ULL) ^
((input >> 24) & 0x0000000000FF0000ULL) ^
((input >> 8) & 0x00000000FF000000ULL) ^
((input << 56) & 0xFF00000000000000ULL) ^
((input << 40) & 0x00FF000000000000ULL) ^
((input << 24) & 0x0000FF0000000000ULL) ^
((input << 8) & 0x000000FF00000000ULL));
}
uint64_t problem3(uint64_t input) {
return (((input & 0xFF00000000000000ULL) >> 56) ^
((input & 0x00FF000000000000ULL) >> 40) ^
((input & 0x0000FF0000000000ULL) >> 24) ^
((input & 0x000000FF00000000ULL) >> 8) ^
((input & 0x00000000000000FFULL) << 56) ^
((input & 0x000000000000FF00ULL) << 40) ^
((input & 0x0000000000FF0000ULL) << 24) ^
((input & 0x00000000FF000000ULL) << 8));
}
uint64_t problem4(uint64_t input) {
return (((input >> 56) & 0x00000000000000FFULL) +
((input << 56) & 0xFF00000000000000ULL) +
((input >> 40) & 0x000000000000FF00ULL) +
((input << 40) & 0x00FF000000000000ULL) +
((input >> 24) & 0x0000000000FF0000ULL) +
((input << 24) & 0x0000FF0000000000ULL) +
((input >> 8) & 0x00000000FF000000ULL) +
((input << 8) & 0x000000FF00000000ULL));
}
https://godbolt.org/z/vzznPz
--
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/20200816/c19392f6/attachment.html>
More information about the llvm-bugs
mailing list