correct counting bits to return a u8

Also add an impl to the dev backend
This commit is contained in:
Brendan Hansknecht 2023-12-03 15:41:49 -08:00
parent e336aa525c
commit 6692f5b15d
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
4 changed files with 36 additions and 21 deletions

View file

@ -1765,6 +1765,21 @@ trait Backend<'a> {
let intrinsic = bitcode::NUM_IS_MULTIPLE_OF[int_width].to_string();
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
}
LowLevel::NumCountLeadingZeroBits => {
let int_width = arg_layouts[0].try_int_width().unwrap();
let intrinsic = bitcode::NUM_COUNT_LEADING_ZERO_BITS[int_width].to_string();
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
}
LowLevel::NumCountTrailingZeroBits => {
let int_width = arg_layouts[0].try_int_width().unwrap();
let intrinsic = bitcode::NUM_COUNT_TRAILING_ZERO_BITS[int_width].to_string();
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
}
LowLevel::NumCountOneBits => {
let int_width = arg_layouts[0].try_int_width().unwrap();
let intrinsic = bitcode::NUM_COUNT_ONE_BITS[int_width].to_string();
self.build_fn_call(sym, intrinsic, args, arg_layouts, ret_layout);
}
LowLevel::ListSublist => {
// list: RocList,
// alignment: u32,