aboutsummaryrefslogtreecommitdiff
path: root/src/all_types.hpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-09 14:44:33 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-09 14:44:33 -0500
commit0a7bdc00771dbad1dfe5eb93a7cade89059d227a (patch)
tree8cb52e6e9ce0e52a63bccd5974c1a7c6150dfdce /src/all_types.hpp
parenta8a63feba7e40a998b1e1d8d36169e5f1be0d4e1 (diff)
downloadzig-0a7bdc00771dbad1dfe5eb93a7cade89059d227a.tar.gz
zig-0a7bdc00771dbad1dfe5eb93a7cade89059d227a.zip
implement vector addition with safety checking
this would work if @llvm.sadd.with.overflow supported vectors, which it does in trunk. but it does not support them in llvm 7 or even in llvm 8 release branch. so the next commit after this will have to do a different strategy, but when llvm 9 comes out it may be worth coming back to this one.
Diffstat (limited to 'src/all_types.hpp')
-rw-r--r--src/all_types.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp
index 842c9ae904..908c0e327c 100644
--- a/src/all_types.hpp
+++ b/src/all_types.hpp
@@ -1538,6 +1538,8 @@ enum ZigLLVMFnId {
ZigLLVMFnIdBitReverse,
};
+// There are a bunch of places in code that rely on these values being in
+// exactly this order.
enum AddSubMul {
AddSubMulAdd = 0,
AddSubMulSub = 1,
@@ -1563,6 +1565,7 @@ struct ZigLLVMFnKey {
struct {
AddSubMul add_sub_mul;
uint32_t bit_count;
+ uint32_t vector_len; // 0 means not a vector
bool is_signed;
} overflow_arithmetic;
struct {