10 #include <sys/types.h>
11 #include <sys/select.h>
16 long double __attribute__((noinline)) insn(long flags) \
24 " " #insn " %%st(1), %%st" "\n" \
25 " ffree %%st(1)" "\n" \
47 void sighandler(int sig
)
49 printf("[FAIL]\tGot signal %d, exiting\n", sig
);
53 int main(int argc
, char **argv
, char **envp
)
57 /* SIGILL triggers on 32-bit kernels w/o fcomi emulation
58 * when run with "no387 nofxsr". Other signals are caught
61 signal(SIGILL
, sighandler
);
62 signal(SIGFPE
, sighandler
);
63 signal(SIGSEGV
, sighandler
);
65 printf("[RUN]\tTesting fcmovCC instructions\n");
66 /* If fcmovCC() returns 1.0, the move wasn't done */
67 err
|= !(fcmovb(0) == 1.0); err
|= !(fcmovnb(0) != 1.0);
68 err
|= !(fcmove(0) == 1.0); err
|= !(fcmovne(0) != 1.0);
69 err
|= !(fcmovbe(0) == 1.0); err
|= !(fcmovnbe(0) != 1.0);
70 err
|= !(fcmovu(0) == 1.0); err
|= !(fcmovnu(0) != 1.0);
72 err
|= !(fcmovb(CF
) != 1.0); err
|= !(fcmovnb(CF
) == 1.0);
73 err
|= !(fcmove(CF
) == 1.0); err
|= !(fcmovne(CF
) != 1.0);
74 err
|= !(fcmovbe(CF
) != 1.0); err
|= !(fcmovnbe(CF
) == 1.0);
75 err
|= !(fcmovu(CF
) == 1.0); err
|= !(fcmovnu(CF
) != 1.0);
77 err
|= !(fcmovb(ZF
) == 1.0); err
|= !(fcmovnb(ZF
) != 1.0);
78 err
|= !(fcmove(ZF
) != 1.0); err
|= !(fcmovne(ZF
) == 1.0);
79 err
|= !(fcmovbe(ZF
) != 1.0); err
|= !(fcmovnbe(ZF
) == 1.0);
80 err
|= !(fcmovu(ZF
) == 1.0); err
|= !(fcmovnu(ZF
) != 1.0);
82 err
|= !(fcmovb(PF
) == 1.0); err
|= !(fcmovnb(PF
) != 1.0);
83 err
|= !(fcmove(PF
) == 1.0); err
|= !(fcmovne(PF
) != 1.0);
84 err
|= !(fcmovbe(PF
) == 1.0); err
|= !(fcmovnbe(PF
) != 1.0);
85 err
|= !(fcmovu(PF
) != 1.0); err
|= !(fcmovnu(PF
) == 1.0);
88 printf("[OK]\tfcmovCC\n");
90 printf("[FAIL]\tfcmovCC errors: %d\n", err
);