blob: 6b2fa7e8d146a296aac989810b0e0f932de93684 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* { dg-do run } */
/* { dg-options "-O0" } */
#include <x86intrin.h>
#ifdef __x86_64__
#define EFLAGS_TYPE unsigned long long int
#else
#define EFLAGS_TYPE unsigned int
#endif
static EFLAGS_TYPE
readeflags_test (unsigned int a, unsigned int b)
{
unsigned x = (a == b);
return __readeflags ();
}
int
main ()
{
EFLAGS_TYPE flags;
flags = readeflags_test (100, 100);
if ((flags & 1) != 0) /* Read CF */
abort ();
flags = readeflags_test (100, 101);
if ((flags & 1) == 0) /* Read CF */
abort ();
#ifdef DEBUG
printf ("PASSED\n");
#endif
return 0;
}
|