<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 - Using an enum instead of literal + optimizing causes backend to fail with an operand error"
href="https://bugs.llvm.org/show_bug.cgi?id=45780">45780</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Using an enum instead of literal + optimizing causes backend to fail with an operand error
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Levo.DeLellis@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23436" name="attach_23436" title="test code to reproduce error">attachment 23436</a> <a href="attachment.cgi?id=23436&action=edit" title="test code to reproduce error">[details]</a></span>
test code to reproduce error
I didn't see this report with a quick search. Here's a minimal reproducible
example. The error is `input128 & AlignMask` inside of __builtin_shufflevector.
Using literal 15 or the define doesn't cause the problem. No optimizing doesn't
cause the problem. O1, 2 and 3 causes the error.
$ cat test.cpp
//clang++-10 -O2 test.cpp
//clang 9 also crashes, must optimize
#include <emmintrin.h>
#include <immintrin.h>
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned char u8v16 __attribute__ ((vector_size (16)));
enum { AlignMask=15 };
//#define AlignMask 15
u8 data[1024*1024*100] __attribute__ ((aligned(64)));
u16 data_out[sizeof(data)] __attribute__ ((aligned(64)));
u8 token_len[sizeof(data)] __attribute__ ((aligned(64)));
u8v16 HighTable = {3, 0, 33, 12, 4, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
u8v16 LowTable = {13, 12, 12, 12, 12, 12, 12, 12, 12, 13, 6, 4, 4, 5, 36, 20};
void Test()
{
auto pdata_end = data+sizeof(data);
for(auto pinput=data; pinput<pdata_end; pinput+=16)
{
auto input128 = (u8v16)_mm_load_si128((__m128i*)pinput);
const auto lo_val = __builtin_shufflevector(LowTable, input128
& AlignMask);
_mm_store_si128((__m128i*)token_len, lo_val);
}
}
int main()
{
Test();
return 0;
}
$ clang++-10 -O2 test.cpp
fatal error: error in backend: Do not know how to split this operator's
operand!
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test-58cf11.cpp
clang: note: diagnostic msg: /tmp/test-58cf11.sh
clang: note: diagnostic msg:
********************</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>