Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / readeflags-1.c
blobd0dd0da45550aa615b83c3c32f7f5bf0c8ac8f4b
1 /* { dg-do run } */
2 /* { dg-options "-O0" } */
4 #include <x86intrin.h>
6 extern void abort (void);
8 #ifdef __x86_64__
9 #define EFLAGS_TYPE unsigned long long int
10 #else
11 #define EFLAGS_TYPE unsigned int
12 #endif
14 __attribute__((noinline, noclone))
15 EFLAGS_TYPE
16 readeflags_test (unsigned int a, unsigned int b)
18 volatile char x = (a == b);
19 return __readeflags ();
22 int
23 main ()
25 EFLAGS_TYPE flags;
27 flags = readeflags_test (100, 100);
29 if ((flags & 1) != 0) /* Read CF */
30 abort ();
32 flags = readeflags_test (100, 101);
34 if ((flags & 1) == 0) /* Read CF */
35 abort ();
37 #ifdef DEBUG
38 printf ("PASSED\n");
39 #endif
41 return 0;