<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 - Binary operators should consistently warn/error with mismatching vector types"
href="https://bugs.llvm.org/show_bug.cgi?id=43045">43045</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Binary operators should consistently warn/error with mismatching vector types
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>greg.bedwell@sony.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk, warren_ristow@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre><a href="https://godbolt.org/z/T4BOcu">https://godbolt.org/z/T4BOcu</a>
#include <x86intrin.h>
__v16qi add(__v4si x, __v4sf y) {
return x + y;
}
__v16qi mul(__v4si x, __v8hi y) {
return x * y;
}
We can have different source/destination types for vectors and at first glance
have no idea what code will be generated, and get nothing to indicate what's
going on (even with -Weverything enabled).
They are silently bitcasting to/from the first source type:
define <16 x i8> @add(<4 x i32> %0, <4 x float> %1) {
%3 = bitcast <4 x float> %1 to <4 x i32>
%4 = add <4 x i32> %3, %0
%5 = bitcast <4 x i32> %4 to <16 x i8>
ret <16 x i8> %5
}
We should at least get a warning that this is happening for both the implicit
bitcasting of the second source and to the destination types, this should work
in parallel to the -flax-vector-conversions switch.
Interestingly, the shift operators are a lot stricter and will error out on
type mismatches with different vector element count/size:
__v16qi shl(__v4si x, __v4sf y) {
return x << y;
}
__v16qi shl(__v4si x, __v4di y) {
return x << y;
}</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>