aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-26 17:48:51 +0100
committergingerBill <bill@gingerbill.org>2022-05-26 17:48:51 +0100
commit20e7b5c88acb2e0cee64ccdec7247227306a345f (patch)
tree9f58fb43f939595bbd75a9d70af1bdd14a722086 /src/check_builtin.cpp
parent7092273a8f5a2ae8c60ece297e7114a29e0f3652 (diff)
Support `count_ones` etc with #simd
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index c63c67d90..ee805702d 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -3559,7 +3559,14 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
return false;
}
- if (!is_type_integer_like(x.type)) {
+ if (is_type_simd_vector(x.type) && id != BuiltinProc_reverse_bits) {
+ Type *elem = base_array_type(x.type);
+ if (!is_type_integer_like(elem)) {
+ gbString xts = type_to_string(x.type);
+ error(x.expr, "#simd values passed to '%.*s' must have an element of an integer-like type (integer, boolean, enum, bit_set), got %s", LIT(builtin_name), xts);
+ gb_string_free(xts);
+ }
+ } else if (!is_type_integer_like(x.type)) {
gbString xts = type_to_string(x.type);
error(x.expr, "Values passed to '%.*s' must be an integer-like type (integer, boolean, enum, bit_set), got %s", LIT(builtin_name), xts);
gb_string_free(xts);