-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add test for ilog2 #93
base: main
Are you sure you want to change the base?
Conversation
// 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 comment
The 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 comment
The 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 ilog2
IL is refused by LLVM.
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.
OK. Should we close this?
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.
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 comment
The 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 comment
The 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 comment
The 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?
Read the llvm-filecheck docs? Have you tried running this locally?
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.
What is it you're looking for, here?
Historically, ilog2 would cause a linkage error that was very difficult to diagnose.
Have you tried running this locally?
Not recently, no. I'll try to take a look at it this week and update it according to the llvm-filecheck docs.
@@ -0,0 +1,13 @@ | |||
// assembly-output: bpf-linker | |||
// compile-flags: --crate-type cdylib -C link-arg=--unroll-loops -C link-arg=-O3 |
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 😀
It seems that LLVM does not have an instruction pattern for ilog2/leading bits/trailing bits. This adds a test case for this behaviour.
This change is