Exemplo n.º 1
0
ir_expression::ir_expression(int op, const struct glsl_type *type,
			     ir_rvalue *op0, ir_rvalue *op1)
{
   assert(((op1 == NULL) && (get_num_operands(ir_expression_operation(op)) == 1))
	  || (get_num_operands(ir_expression_operation(op)) == 2));
   this->ir_type = ir_type_expression;
   this->type = type;
   this->operation = ir_expression_operation(op);
   this->operands[0] = op0;
   this->operands[1] = op1;
   this->operands[2] = NULL;
   this->operands[3] = NULL;
}
Exemplo n.º 2
0
/* Return a completely initialised control block */
IRICB
new_iricb(const irop_t *op, test_data_t *data)
{
   IRICB cb;

   cb.op = op->op;
   cb.result = (HWord)&data->result.value;
   cb.opnd1  = (HWord)&data->opnds[0].value;
   cb.opnd2  = (HWord)&data->opnds[1].value;
   cb.opnd3  = (HWord)&data->opnds[2].value;
   cb.opnd4  = (HWord)&data->opnds[3].value;
   cb.t_result = data->result.type;
   cb.t_opnd1  = data->opnds[0].type;
   cb.t_opnd2  = data->opnds[1].type;
   cb.t_opnd3  = data->opnds[2].type;
   cb.t_opnd4  = data->opnds[3].type;

   cb.rounding_mode = data->rounding_mode;

   cb.num_operands = get_num_operands(op->op);

   cb.immediate_index = op->immediate_index;
   cb.immediate_type  = op->immediate_type;

   return cb;
}
Exemplo n.º 3
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");
   }
}
Exemplo n.º 4
0
ir_expression::ir_expression(int op, const struct glsl_type *type,
			     ir_rvalue *op0)
: ir_rvalue(precision_from_ir(op0))
{
   assert(get_num_operands(ir_expression_operation(op)) == 1);
   this->ir_type = ir_type_expression;
   this->type = type;
   this->operation = ir_expression_operation(op);
   this->operands[0] = op0;
   this->operands[1] = NULL;
   this->operands[2] = NULL;
   this->operands[3] = NULL;
}
Exemplo n.º 5
0
ir_expression::ir_expression(int op, const struct glsl_type *type,
			     ir_rvalue *op0, ir_rvalue *op1,
			     ir_rvalue *op2, ir_rvalue *op3)
{
   this->ir_type = ir_type_expression;
   this->type = type;
   this->operation = ir_expression_operation(op);
   this->operands[0] = op0;
   this->operands[1] = op1;
   this->operands[2] = op2;
   this->operands[3] = op3;
#ifndef NDEBUG
   int num_operands = get_num_operands(this->operation);
   for (int i = num_operands; i < 4; i++) {
      assert(this->operands[i] == NULL);
   }
#endif
}
Exemplo n.º 6
0
/* 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");
}
bool
ir_expression::equals(ir_instruction *ir)
{
   const ir_expression *other = ir->as_expression();
   if (!other)
      return false;

   if (type != other->type)
      return false;

   if (operation != other->operation)
      return false;

   for (unsigned i = 0; i < get_num_operands(); i++) {
      if (!operands[i]->equals(other->operands[i]))
         return false;
   }

   return true;
}