class lower_64bit_visitor : public ir_rvalue_visitor {
public:
lower_64bit_visitor(void *mem_ctx, exec_list *instructions, unsigned lower)
- : progress(false), lower(lower), instructions(instructions),
+ : progress(false), lower(lower),
function_list(), added_functions(&function_list, mem_ctx)
{
functions = _mesa_hash_table_create(mem_ctx,
- _mesa_key_hash_string,
+ _mesa_hash_string,
_mesa_key_string_equal);
foreach_in_list(ir_instruction, node, instructions) {
private:
unsigned lower; /** Bitfield of which operations to lower */
- exec_list *instructions;
-
/** Hashtable containing all of the known functions in the IR */
struct hash_table *functions;
} /* anonymous namespace */
-static bool
-is_integer_64(const glsl_type *t)
-{
- return t->base_type == GLSL_TYPE_UINT64 || t->base_type == GLSL_TYPE_INT64;
-}
-
/**
* Determine if a particular type of lowering should occur
*/
ir_rvalue *val,
ir_variable **expanded_src)
{
- assert(val->type->base_type == GLSL_TYPE_UINT64 ||
- val->type->base_type == GLSL_TYPE_INT64);
+ assert(val->type->is_integer_64());
ir_variable *const temp = body.make_temp(val->type, "tmp");
ir_expression *ir,
ir_function_signature *callee)
{
- const unsigned num_operands = ir->get_num_operands();
+ const unsigned num_operands = ir->num_operands;
ir_variable *src[4][4];
ir_variable *dst[4];
void *const mem_ctx = ralloc_parent(ir);
const char *function_name,
function_generator generator)
{
- for (unsigned i = 0; i < ir->get_num_operands(); i++)
- if (!is_integer_64(ir->operands[i]->type))
+ for (unsigned i = 0; i < ir->num_operands; i++)
+ if (!ir->operands[i]->type->is_integer_64())
return ir;
/* Get a handle to the correct ir_function_signature for the core
add_function(f);
}
+ this->progress = true;
return lower_op_to_function_call(this->base_ir, ir, callee);
}
assert(ir != NULL);
switch (ir->operation) {
+ case ir_unop_sign:
+ if (lowering(SIGN64)) {
+ *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
+ }
+ break;
+
+ case ir_binop_div:
+ if (lowering(DIV64)) {
+ if (ir->type->base_type == GLSL_TYPE_UINT64) {
+ *rvalue = handle_op(ir, "__builtin_udiv64", generate_ir::udiv64);
+ } else {
+ *rvalue = handle_op(ir, "__builtin_idiv64", generate_ir::idiv64);
+ }
+ }
+ break;
+
+ case ir_binop_mod:
+ if (lowering(MOD64)) {
+ if (ir->type->base_type == GLSL_TYPE_UINT64) {
+ *rvalue = handle_op(ir, "__builtin_umod64", generate_ir::umod64);
+ } else {
+ *rvalue = handle_op(ir, "__builtin_imod64", generate_ir::imod64);
+ }
+ }
+ break;
+
case ir_binop_mul:
if (lowering(MUL64)) {
*rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
- this->progress = true;
}
break;