[llvm-bugs] [Bug 39733] New: Compiler generating unsupported AVX2 instruction for non-AVX2 target after r346784
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Nov 20 16:34:43 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39733
Bug ID: 39733
Summary: Compiler generating unsupported AVX2 instruction for
non-AVX2 target after r346784
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: douglas_yung at playstation.sony.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
After commit r346784, we started to notice that some of our internal tests were
failing with an illegal instruction. Upon inspection, it looks like the
compiler is now generating an AVX2 instruction when the architecture specified
(btver2 in this case) does not support it leading to an exception at runtime.
Here is the trimmed example from our test:
/* repro.cpp */
typedef signed int sint;
typedef sint __attribute__((ext_vector_type(8))) sint8;
typedef short __attribute__((ext_vector_type(8))) short8;
#define convertvector_short8_sint8(__A) (__builtin_convertvector(__A, sint8))
void test55() {
short8 id11762 =
(short8){(short)-186357704, (short)-396064952, (short)-792594146,
(short)1159072119, (short)1939245255, (short)-530257005,
(short)870979680, (short)-2063923297}; // vec_type
sint8 id11761 = convertvector_short8_sint8(id11762);
}
If you compile this with the options "-O0 -march=btver2" and examine the
assembly that is generated for function test55(), you will see the following
instruction being generated:
vpmovsxwd 64(%rsp), %ymm1
If you look at the documentation for the vpmovsxwd instruction, you will see
that the form that accepts ymm registers requires AVX2 support which btver2
does not support.
--
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/20181121/5255d480/attachment.html>
More information about the llvm-bugs
mailing list