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: unassignedclangb...@nondot.org
Reporter: llvm-...@redking.me.uk
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs