Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / readeflags-1.c
blob6b2fa7e8d146a296aac989810b0e0f932de93684
1 /* { dg-do run } */
2 /* { dg-options "-O0" } */
4 #include <x86intrin.h>
6 #ifdef __x86_64__
7 #define EFLAGS_TYPE unsigned long long int
8 #else
9 #define EFLAGS_TYPE unsigned int
10 #endif
12 static EFLAGS_TYPE
13 readeflags_test (unsigned int a, unsigned int b)
15 unsigned x = (a == b);
16 return __readeflags ();
19 int
20 main ()
22 EFLAGS_TYPE flags;
24 flags = readeflags_test (100, 100);
26 if ((flags & 1) != 0) /* Read CF */
27 abort ();
29 flags = readeflags_test (100, 101);
31 if ((flags & 1) == 0) /* Read CF */
32 abort ();
34 #ifdef DEBUG
35 printf ("PASSED\n");
36 #endif
38 return 0;