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