diff options
Diffstat (limited to 'src/llvm_backend_utility.cpp')
| -rw-r--r-- | src/llvm_backend_utility.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp index 367e7be75..8a7bced59 100644 --- a/src/llvm_backend_utility.cpp +++ b/src/llvm_backend_utility.cpp @@ -648,6 +648,18 @@ gb_internal lbValue lb_emit_count_leading_zeros(lbProcedure *p, lbValue x, Type return res; } +gb_internal lbValue lb_emit_unary_arith(lbProcedure *p, TokenKind op, lbValue x, Type *type); + +gb_internal lbValue lb_emit_count_trailing_ones(lbProcedure *p, lbValue x, Type *type) { + lbValue z = lb_emit_unary_arith(p, Token_Xor, x, type); + return lb_emit_count_trailing_zeros(p, z, type); +} + +gb_internal lbValue lb_emit_count_leading_ones(lbProcedure *p, lbValue x, Type *type) { + lbValue z = lb_emit_unary_arith(p, Token_Xor, x, type); + return lb_emit_count_leading_zeros(p, z, type); +} + gb_internal lbValue lb_emit_reverse_bits(lbProcedure *p, lbValue x, Type *type) { |