コード例 #1
0
/* Execute the test under valgrind. Well, yes, we're not really executing
   it here, just preparing for it... */
void
valgrind_execute_test(const irop_t *op, test_data_t *data)
{
   unsigned i, num_operands;

   if (verbose > 2) printf("---------- Running a test\n");
   num_operands = get_num_operands(op->op);

   for (i = 0; i < num_operands; ++i) {
      valgrind_set_vbits(&data->opnds[i]);
      if (verbose > 2) {
         printf("opnd #%u:  ", i);
         print_opnd(stdout, &data->opnds[i]);
         printf("\n");
      }
   }
   if (verbose > 2)
      if (data->rounding_mode != NO_ROUNDING_MODE)
         printf("rounding mode %u\n", data->rounding_mode);

   valgrind_vex_inject_ir();
   valgrind_get_vbits(&data->result);
   if (verbose > 2) {
      printf("result:   ");
      print_opnd(stdout, &data->result);
      printf("\n");
   }
}
コード例 #2
0
ファイル: util.c プロジェクト: MIPS/external-valgrind
/* Issue a complaint because the V-bits of the result of an operation
   differ from what was expected. */
void
complain(const irop_t *op, const test_data_t *data, vbits_t expected)
{
   fprintf(stderr, "*** Incorrect result for operator %s\n", op->name);
   
   int num_operands = get_num_operands(op->op);

   for (unsigned i = 0; i < num_operands; ++i) {
      fprintf(stderr, "    opnd %u:  ", i);
      print_opnd(stderr, &data->opnds[i]);
      fprintf(stderr, "\n");
   }
   fprintf(stderr, "    result:  ");
   print_opnd(stderr, &data->result);
   fprintf(stderr, "\n");
   fprintf(stderr, "    expect:  vbits = ");
   print_vbits(stderr, expected);
   fprintf(stderr, "\n");
}