diff options
| author | gingerBill <bill@gingerbill.org> | 2022-05-26 17:48:51 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-05-26 17:48:51 +0100 |
| commit | 20e7b5c88acb2e0cee64ccdec7247227306a345f (patch) | |
| tree | 9f58fb43f939595bbd75a9d70af1bdd14a722086 /src/llvm_backend_utility.cpp | |
| parent | 7092273a8f5a2ae8c60ece297e7114a29e0f3652 (diff) | |
Support `count_ones` etc with #simd
Diffstat (limited to 'src/llvm_backend_utility.cpp')
| -rw-r--r-- | src/llvm_backend_utility.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp index bfd21bedb..52d3a17cf 100644 --- a/src/llvm_backend_utility.cpp +++ b/src/llvm_backend_utility.cpp @@ -485,8 +485,10 @@ lbValue lb_emit_count_ones(lbProcedure *p, lbValue x, Type *type) { } lbValue lb_emit_count_zeros(lbProcedure *p, lbValue x, Type *type) { - i64 sz = 8*type_size_of(type); - lbValue size = lb_const_int(p->module, type, cast(u64)sz); + Type *elem = base_array_type(type); + i64 sz = 8*type_size_of(elem); + lbValue size = lb_const_int(p->module, elem, cast(u64)sz); + size = lb_emit_conv(p, size, type); lbValue count = lb_emit_count_ones(p, x, type); return lb_emit_arith(p, Token_Sub, size, count, type); } |