diff --git a/tests/assembly/ilog2.rs b/tests/assembly/ilog2.rs new file mode 100644 index 00000000..3dad216f --- /dev/null +++ b/tests/assembly/ilog2.rs @@ -0,0 +1,13 @@ +// assembly-output: bpf-linker +// compile-flags: --crate-type cdylib -C link-arg=--unroll-loops -C link-arg=-O3 +#![no_std] +// bpf target did not historically support the ilog2 operation because LLVM did +// not have a way to do leading/trailing bits + +// aux-build: loop-panic-handler.rs +extern crate loop_panic_handler; + +#[no_mangle] +fn foo(arg: &mut u64) { + *arg = arg.ilog2() as u64; +}