[llvm-bugs] [Bug 49055] New: [X86] or/add-like mismatch in uchar 'splat' to uint
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 5 04:12:56 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49055
Bug ID: 49055
Summary: [X86] or/add-like mismatch in uchar 'splat' to uint
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: craig.topper at gmail.com, lebedev.ri at gmail.com,
llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com
https://simd.godbolt.org/z/E15MrP
void loop_add(const unsigned char* __restrict pIn, unsigned int* __restrict
pOut, int s) {
for (int i = 0; i < s; i++) {
unsigned int pixelChar = pIn[i];
unsigned int pixel = pixelChar + (pixelChar << 8) + (pixelChar << 16) +
(255 << 24);
pOut[i] = pixel;
}
}
This successfully combines to a zext+mul+add (I think technically it could be
zext+mul+or)?
But this:
void loop_or(const unsigned char* __restrict pIn, unsigned int* __restrict
pOut, int s) {
for (int i = 0; i < s; i++) {
unsigned int pixelChar = pIn[i];
unsigned int pixel = pixelChar | (pixelChar << 8) | (pixelChar << 16) |
(255 << 24);
pOut[i] = pixel;
}
}
completely fails and we end up with a long shift+or chain.
--
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/20210205/b59da1fd/attachment.html>
More information about the llvm-bugs
mailing list