Clear floating point condition codes in the test after calling external
function (in this case printf), as it might have clobbered fcc bits in
fcsr.
This resolves none/tests/mips64/round.c failure on some systems.
Patch by Aleksandra Karadzic.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16038
}
}
+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:
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:
int i;
int fcsr = 0;
for (i = 0; i < MAX_ARR; i++) {
+ clear_fcc();
switch(op) {
case CEILWS:
UNOPfw("ceil.w.s");
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:
break;
}
}
+
+void clear_fcc(){
+ __asm__ __volatile__(
+ "cfc1 $t0, $31" "\n\t"
+ "and $t0, $t0, 0x17FFFFF" "\n\t"
+ "ctc1 $t0, $31" "\n\t"
+ :
+ :
+ : "t0"
+ );
+}
#endif