<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57905>57905</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Elementwise builtins are not constexpr
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:codegen
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
https://simd.godbolt.org/z/E4KcoTfdP
```
typedef int __v4si __attribute__((__vector_size__(16)));
constexpr __v4si minmax(__v4si x, __v4si y) {
return __builtin_elementwise_max(x, y);
}
```
clang -g0 -O3
```
<source>:3:18: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
constexpr __v4si minmax(__v4si x, __v4si y) {
^
<source>:4:12: note: subexpression not valid in a constant expression
return __builtin_elementwise_max(x, y);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU0uP2yAQ_jX4YiWywc-DD7ub9LKHVm2lHi0MY4cKQ8Qj3eyv79hJdrdVbi0aDPPgY74ZPFh57g4hHD1hD4R-QvFqltvJysHqsLVuQtMrzn3xLOz3UX4h2Y5kD6TKrrKq4XwECWOqTEj7_lR4hQsPwakhBuh7QhsU9IAI1vVevV6MeUVoexX2eMES1vgAL0d3Q5qVmfnL5fyi4_bp5jvjyZTU16MpDgchOoP-ISodlOlBwwwm_FIe-gvOCnD-eCepd3d5Cc3NlG6mLN18ZncjCHvyNjoBhO2xhgxn3uAnBeesWzbvfMZoRFDWpAZO4NKjszIK8Cm_xHAs3hIH3i9BpHzc_FDmxLWSmzcQUu7-S5n-GKTc32VTLGzoQsLYAMvq4_AhRbSma37Y-Pss_rUvt2In0OVVxZqyLViVyI7JlrU8CSpo6PbvSOkVHYvqYM3vrU5JdPqvtz6pcIjDVtgZFa1Pt2WDrfmJTxVV5X0Ej5uybrMyOXSQC5rlnFVjNYqyLkUleSXKsayrsckkJJoPoH2H7SOUrg8I7xNWwgQGLdjARHU0ozRrKc3LPGPVth7aomGioE3ZMD5IUmQwc6W3SzbLX5i4bk1siJNHp1Y--Hcnx1pPBmC9FPF5DAfruq_P39RsTbJy6FYCvwEYAThq">