]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge from trunk:
authorJulian Seward <jseward@acm.org>
Tue, 18 Oct 2016 05:14:29 +0000 (05:14 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 18 Oct 2016 05:14:29 +0000 (05:14 +0000)
  16038  mips: clear fcc bits in fcsr after calling printf()

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_12_BRANCH@16064

none/tests/mips32/round.c
none/tests/mips64/round.c
none/tests/mips64/rounding_mode.h

index 310dd367c1dda36ec437b1886d49ee16db7bb30d..710c15adea495ff232e66fbcf281c8c37813c91d 100644 (file)
@@ -149,12 +149,24 @@ void set_rounding_mode(round_mode_t mode)
    }
 }
 
+void clear_fcc(){
+   __asm__ __volatile__(
+      "cfc1 $t0, $31"            "\n\t"
+      "and  $t0, $t0, 0x17FFFFF" "\n\t"
+      "ctc1 $t0, $31"            "\n\t"
+      :
+      :
+      : "t0"
+   );
+}
+
 int directedRoundingMode(flt_dir_op_t op) {
    int fd_w = 0;
    int i;
    int fcsr = 0;
    round_mode_t rm = TO_NEAREST;
    for (i = 0; i < 24; i++) {
+      clear_fcc();
       set_rounding_mode(rm);
       switch(op) {
          case CEILWS:
@@ -217,6 +229,7 @@ int FCSRRoundingMode(flt_round_op_t op1)
       set_rounding_mode(rm);
       printf("roundig mode: %s\n", round_mode_name[rm]);
       for (i = 0; i < 24; i++) {
+         clear_fcc();
          set_rounding_mode(rm);
          switch(op1) {
             case CVTDS:
index e46c7b6faed61100f9c2db8dca730b3e7e5220f4..463405719057ec9ee54803066d82339da17afd70 100644 (file)
@@ -9,6 +9,7 @@ int directedRoundingMode(flt_dir_op_t op) {
    int i;
    int fcsr = 0;
    for (i = 0; i < MAX_ARR; i++) {
+      clear_fcc();
       switch(op) {
          case CEILWS:
               UNOPfw("ceil.w.s");
@@ -111,6 +112,7 @@ int FCSRRoundingMode(flt_round_op_t op1)
       set_rounding_mode(rm);
       printf("roundig mode: %s\n", round_mode_name[rm]);
       for (i = 0; i < MAX_ARR; i++) {
+         clear_fcc();
          set_rounding_mode(rm);
          switch(op1) {
             case CVTDS:
index 38354be9dd03beb3421fd51a73b90e41452655ce..c42cb340c5642068ab9b930fa37192f7fb660b82 100644 (file)
@@ -60,4 +60,15 @@ void set_rounding_mode(round_mode_t mode)
          break;
       }
 }
+
+void clear_fcc(){
+   __asm__ __volatile__(
+      "cfc1 $t0, $31"            "\n\t"
+      "and  $t0, $t0, 0x17FFFFF" "\n\t"
+      "ctc1 $t0, $31"            "\n\t"
+      :
+      :
+      : "t0"
+   );
+}
 #endif