AVX/AVX2 not correcly detected in user mode
Hi,
Thanks for supporting AVX/AVX2 in 7.2. However it seems that canonical detection of feature does not work in user mode, this fail qemu-x86_64 -cpu qemu64,+avx ./a.out
include <sys/resource.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <argp.h>
#include <sys/auxv.h>
#if defined(__x86_64__) || defined(__i386__)
#include <sys/platform/x86.h>
#endif
const char *argp_program_version = "test-x86-64-v3 version 17";
static char doc[] = "doc";
static struct argp argp = { 0, 0, 0, doc };
const struct rlimit nocore = { 0, 0 };
/* emulate kill by signal */
void
termination_handler (int signum)
{
_exit(128+signum);
}
int main(int argc,char **argv)
{
/* no core */
(void) setrlimit(RLIMIT_CORE, &nocore);
/* return instead */
struct sigaction new_action;
new_action.sa_handler = termination_handler;
(void) sigemptyset (&new_action.sa_mask);
new_action.sa_flags = 0;
(void) sigaction (SIGILL, &new_action, NULL);
(void) sigaction (SIGBUS, &new_action, NULL);
(void) sigaction (SIGSEGV, &new_action, NULL);
argp_parse (&argp, argc, argv, 0, 0, 0);
/* now test */
return !(
__builtin_cpu_supports("avx")
);;
return 0;
}