-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[BPF] expand cttz, ctlz for i32, i64 #73668
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
Conversation
Please ref: #73668 for test coverage
c41b11a
to
1839091
Compare
bfdbfe5
to
c9afc89
Compare
Pinging @yonghong-song |
@eddyz87 Could you please take a look? This has been stalled for a while :) |
Hello, I tried this with simple C test: unsigned int test(unsigned int v) {
return __builtin_ctz(v);
//return __builtin_clz(v);
}
The
|
Nevermind, I missed the "depends" part :( |
I tried this with the test below using current kernel master, and all works as expected. diff --git a/tools/testing/selftests/bpf/progs/verifier_and.c b/tools/testing/selftests/bpf/progs/verifier_and.c
index e97e518516b6..8a051bd0c886 100644
--- a/tools/testing/selftests/bpf/progs/verifier_and.c
+++ b/tools/testing/selftests/bpf/progs/verifier_and.c
@@ -104,4 +104,14 @@ l0_%=: r0 = 0; \
: __clobber_all);
}
+unsigned A[3] = {1u << 31, 1u << 30, 1u << 29};
+
+SEC("socket") __success __retval(0) int clz1(void *ctx) { return __builtin_clz(A[0]); }
+SEC("socket") __success __retval(1) int clz2(void *ctx) { return __builtin_clz(A[1]); }
+SEC("socket") __success __retval(2) int clz3(void *ctx) { return __builtin_clz(A[2]); }
+
+SEC("socket") __success __retval(31) int ctz1(void *ctx) { return __builtin_ctz(A[0]); }
+SEC("socket") __success __retval(30) int ctz2(void *ctx) { return __builtin_ctz(A[1]); }
+SEC("socket") __success __retval(29) int ctz3(void *ctx) { return __builtin_ctz(A[2]); }
+
char _license[] SEC("license") = "GPL"; |
Adds custom lowering for tconstpool. Please ref: #73668 for test coverage
Fixes: #62252
Depends on: #73667