aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_proc.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-08-05 13:13:19 +0100
committergingerBill <bill@gingerbill.org>2024-08-05 13:13:19 +0100
commit9a01a13914e9b1f577399fed7ed09132306946b1 (patch)
treea39f9d56eb4ea86e586d768bdbf74c85054f5359 /src/llvm_backend_proc.cpp
parenteeb92e2644a8241b6dc6950f6a2712d5164ea4e3 (diff)
Add `simd_reduce_any` and `simd_reduce_all`
Diffstat (limited to 'src/llvm_backend_proc.cpp')
-rw-r--r--src/llvm_backend_proc.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index 2f736ff6c..ee121d6f2 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -1527,6 +1527,23 @@ gb_internal lbValue lb_build_builtin_simd_proc(lbProcedure *p, Ast *expr, TypeAn
return res;
}
+ case BuiltinProc_simd_reduce_any:
+ case BuiltinProc_simd_reduce_all:
+ {
+ char const *name = nullptr;
+ switch (builtin_id) {
+ case BuiltinProc_simd_reduce_any: name = "llvm.vector.reduce.and"; break;
+ case BuiltinProc_simd_reduce_all: name = "llvm.vector.reduce.or"; break;
+ }
+
+ LLVMTypeRef types[1] = { lb_type(p->module, arg0.type) };
+ LLVMValueRef args[1] = { arg0.value };
+
+ res.value = lb_call_intrinsic(p, name, args, gb_count_of(args), types, gb_count_of(types));
+ return res;
+ }
+
+
case BuiltinProc_simd_shuffle:
{
Type *vt = arg0.type;