Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Runtime detection of SVE2 not working as expected

Hello, I used the following guide in order to write code for CPU feature detection at runtime: https://community.arm.com/arm-community-blogs/b/operating-systems-blog/posts/runtime-detection-of-cpu-features-on-an-armv8-a-cpu I modified the HWCAP example so that it reports SVE features:

#include <stdio.h>
#include <sys/auxv.h>
#include <asm/hwcap.h>

int main()
{
    long hwcaps = getauxval(AT_HWCAP);
    printf("FP: %d\n", hwcaps & HWCAP_FP);
    printf("SVE: %d\n", hwcaps & HWCAP_SVE);
    printf("SVE2: %d\n", hwcaps & HWCAP2_SVE2);
    printf("SVEF32MM: %d\n", hwcaps & HWCAP2_SVEF32MM);
    printf("SVEF64MM: %d\n", hwcaps & HWCAP2_SVEF64MM);
    return 0;
}

When I run the program on RPi4, I get strange values for SVE2 and SVEF64MM:

FP: 1
SVE: 0
SVE2: 2
SVEF32MM: 0
SVEF64MM: 2048

I am supposed to get 0es. Why am I getting 2 and 2048?

Parents Reply Children
No data