~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to elf/tst-audit6.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
extern __m128i audit_test (__m128i, __m128i, __m128i, __m128i,
9
9
                           __m128i, __m128i, __m128i, __m128i);
10
10
 
 
11
 
 
12
static int
 
13
avx_enabled (void)
 
14
{
 
15
  unsigned int eax, ebx, ecx, edx;
 
16
 
 
17
  if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
 
18
      || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE))
 
19
    return 0;
 
20
 
 
21
  /* Check the OS has AVX and SSE saving enabled.  */
 
22
  asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
 
23
 
 
24
  return (eax & 6) == 6;
 
25
}
 
26
 
 
27
 
11
28
int
12
29
main (void)
13
30
{
14
 
  unsigned int eax, ebx, ecx, edx;
15
 
 
16
31
  /* Run AVX test only if AVX is supported.  */
17
 
  if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
18
 
      && (ecx & bit_AVX))
 
32
  if (avx_enabled ())
19
33
    {
20
34
      __m128i xmm = _mm_setzero_si128 ();
21
35
      __m128i ret = audit_test (xmm, xmm, xmm, xmm, xmm, xmm, xmm, xmm);