aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-26 11:48:04 +0100
committergingerBill <bill@gingerbill.org>2022-05-26 11:48:04 +0100
commite331b0647e99a07b5d0f70cbac948ab30b30b5c7 (patch)
tree6452f1f0314d13f0b5196acb9bab681216dbbf6e /src/check_builtin.cpp
parent35502816c7d53b0b5fd422537d32efb5c34b1811 (diff)
Add `simd_rotate_left` simd_rotate_right`
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 682667972..54bede3a8 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -933,6 +933,29 @@ bool check_builtin_simd_operation(CheckerContext *c, Operand *operand, Ast *call
return true;
}
+ case BuiltinProc_simd_rotate_left:
+ case BuiltinProc_simd_rotate_right:
+ {
+ Operand x = {};
+ check_expr(c, &x, ce->args[0]); if (x.mode == Addressing_Invalid) { return false; }
+ if (!is_type_simd_vector(x.type)) {
+ error(x.expr, "'%.*s' expected a simd vector type", LIT(builtin_name));
+ return false;
+ }
+ Operand offset = {};
+ check_expr(c, &offset, ce->args[1]); if (offset.mode == Addressing_Invalid) { return false; }
+ convert_to_typed(c, &offset, t_i64);
+ if (!is_type_integer(offset.type) || offset.mode != Addressing_Constant) {
+ error(offset.expr, "'%.*s' expected a constant integer offset");
+ return false;
+ }
+ check_assignment(c, &offset, t_i64, builtin_name);
+
+ operand->type = x.type;
+ operand->mode = Addressing_Value;
+ return true;
+ }
+
default:
GB_PANIC("Unhandled simd intrinsic: %.*s", LIT(builtin_name));
}