[llvm-bugs] [Bug 42461] New: constexpr can't handle vector types
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jul 1 04:44:30 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42461
Bug ID: 42461
Summary: constexpr can't handle vector types
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Blocks: 31446
Godbolt: https://godbolt.org/z/l-RaB7
We are unable to use __vector_size or ext_vector_type defined types in
constexpr functions.
typedef int __v4si __attribute__((__vector_size__(16)));
constexpr int sum_i32(__v4si x) {
return x[0] + x[1] + x[2] + x[3];
}
constexpr __v4si add_i32(__v4si x, __v4si y) {
return x + y;
}
clang -g0 -O3
<source>:3:18: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr __v4si add_i32(__v4si x, __v4si y) {
^
<source>:4:12: note: subexpression not valid in a constant expression
return x + y;
^
<source>:7:15: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
constexpr int sum_i32(__v4si x) {
^
<source>:8:10: note: subexpression not valid in a constant expression
return x[0] + x[1] + x[2] + x[3];
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=31446
[Bug 31446] [feature-request] make vector intrinsics constexpr
--
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/20190701/21911b01/attachment.html>
More information about the llvm-bugs
mailing list