Page 1 of 1

Is using BSF instruction instead of using GNU C __builtin_ctz inefficient?

Posted: 2023-12-25, 7:35:06
by pauljurczak
I posted this question on stackoverflow: https://stackoverflow.com/questions/777 ... imd-vector. The answer claims, among others, that using "legacy BSF instruction (slow on AMD), instead of using GNU C __builtin_ctz on non-MSVC" is inefficient. Is that accurate? I find performance of VCL to be very good, but perhaps it can be even better.

Re: Is using BSF instruction instead of using GNU C __builtin_ctz inefficient?

Posted: 2023-12-25, 8:34:40
by agner
__builtin_ctz is not portable to all compilers. I don't think there is any difference in performance. Let's keep this discussion on stackoverflow. Remember to use the tag "vector-class-library" on stackoverflow.