Remove ${SHELL} from tst-table.sh/tst-tables.sh
[glibc.git] / elf / tst-audit4.c
blobc4f1d5bdb9cf06e26ea2abc61b985a70ad25dc49
1 /* Test case for x86-64 preserved registers in dynamic linker. */
3 #ifdef __AVX__
4 #include <stdlib.h>
5 #include <string.h>
6 #include <cpuid.h>
7 #include <immintrin.h>
10 static int
11 avx_enabled (void)
13 unsigned int eax, ebx, ecx, edx;
15 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
16 || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE))
17 return 0;
19 /* Check the OS has AVX and SSE saving enabled. */
20 asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
22 return (eax & 6) == 6;
26 extern __m256i audit_test (__m256i, __m256i, __m256i, __m256i,
27 __m256i, __m256i, __m256i, __m256i);
28 int
29 main (void)
31 /* Run AVX test only if AVX is supported. */
32 if (avx_enabled ())
34 __m256i ymm = _mm256_setzero_si256 ();
35 __m256i ret = audit_test (ymm, ymm, ymm, ymm, ymm, ymm, ymm, ymm);
37 ymm = _mm256_set1_epi32 (0x12349876);
38 if (memcmp (&ymm, &ret, sizeof (ret)))
39 abort ();
41 return 0;
43 #else
44 int
45 main (void)
47 return 0;
49 #endif