PR422261 platform selection fails for unqualified client name
[valgrind.git] / none / tests / mips64 / test_fcsr.c
bloba99f89e6b6deda7c07e3dba52d420f2e244237e4
1 #include <stdio.h>
2 #include "pub_core_basics.h"
4 /*
5 * Bits 18 (NAN2008) and 19 (ABS2008) are preset by hardware and may differ
6 * between platforms. Hence a macro to clear them before printing FCSR
7 * values.
8 */
9 #define FCSR_NAN2008 1 << 18
10 #define FCSR_ABS2008 1 << 19
11 #define FLAGS_RM_MASK 0xFFFFFFFF & ~(FCSR_ABS2008 | FCSR_NAN2008)
12 #define CLEAR_PRESETBITS_FCSR(fcsr) (fcsr & FLAGS_RM_MASK)
14 int main ()
16 #if defined(__mips_hard_float)
17 RegWord out [] = {0, 0};
18 __asm__ volatile("cfc1 $a1, $31" "\n\t"
19 "dli $t0, 0x405ee0a3d70a3d71" "\n\t"
20 "dmtc1 $t0, $f0" "\n\t"
21 "ctc1 $zero, $31" "\n\t"
22 "round.w.d $f0, $f0" "\n\t"
23 "cfc1 $a2, $31" "\n\t"
24 "sd $a2, 0(%0)" "\n\t"
25 "dli $t0, 0x3ff0000000000000" "\n\t"
26 "dmtc1 $t0, $f0" "\n\t"
27 "ctc1 $zero, $31" "\n\t"
28 "round.w.d $f0, $f0" "\n\t"
29 "cfc1 $a2, $31" "\n\t"
30 "sd $a2, 8(%0)" "\n\t"
31 "ctc1 $a1, $31" "\n\t"
33 : "r" (out)
34 : "a1", "a2", "t0", "$f0"
36 printf("FCSR::1: 0x%" FMT_REGWORD "x, 2: 0x%" FMT_REGWORD "x\n",
37 CLEAR_PRESETBITS_FCSR(out[0]), CLEAR_PRESETBITS_FCSR(out[1]));
38 #endif
39 return 0;