-
Notifications
You must be signed in to change notification settings - Fork 47
Add test for ilog2 #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are you testing here? There's no CHECK; can you add some? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH I do not remember the details of how to use this testing. To my memory, I wanted this to build successfully, but it currently doesn't because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. Should we close this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because this is actually affecting some of my code. Right now, I have to manually compute ilog2. If I ever depended on a crate which uses this functionality, I would be screwed 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do I correctly write this testcase to check that the compilation is successful? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is it you're looking for, here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Read the llvm-filecheck docs? Have you tried running this locally? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Historically, ilog2 would cause a linkage error that was very difficult to diagnose.
Not recently, no. I'll try to take a look at it this week and update it according to the llvm-filecheck docs. |
||
// 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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need unroll-loops and 03? seems superfluous, see https://en.wikipedia.org/wiki/Chekhov%27s_gun
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost certainly copy-pasted this 😀