void find_lsb_to_float_cast(ir_expression *ir);
void find_msb_to_float_cast(ir_expression *ir);
void imul_high_to_mul(ir_expression *ir);
+
+ ir_expression *_carry(operand a, operand b);
};
} /* anonymous namespace */
this->progress = true;
}
+ir_expression *
+lower_instructions_visitor::_carry(operand a, operand b)
+{
+ if (lowering(CARRY_TO_ARITH))
+ return i2u(b2i(less(add(a, b),
+ a.val->clone(ralloc_parent(a.val), NULL))));
+ else
+ return carry(a, b);
+}
+
void
lower_instructions_visitor::imul_high_to_mul(ir_expression *ir)
{
i.insert_before(assign(t2, mul(src1h, src2l)));
i.insert_before(assign(hi, mul(src1h, src2h)));
- i.insert_before(assign(hi, add(hi, carry(lo, lshift(t1, c16->clone(ir, NULL))))));
- i.insert_before(assign(lo, add(lo, lshift(t1, c16->clone(ir, NULL)))));
+ i.insert_before(assign(hi, add(hi, _carry(lo, lshift(t1, c16->clone(ir, NULL))))));
+ i.insert_before(assign(lo, add(lo, lshift(t1, c16->clone(ir, NULL)))));
- i.insert_before(assign(hi, add(hi, carry(lo, lshift(t2, c16->clone(ir, NULL))))));
- i.insert_before(assign(lo, add(lo, lshift(t2, c16->clone(ir, NULL)))));
+ i.insert_before(assign(hi, add(hi, _carry(lo, lshift(t2, c16->clone(ir, NULL))))));
+ i.insert_before(assign(lo, add(lo, lshift(t2, c16->clone(ir, NULL)))));
if (different_signs == NULL) {
assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
i.insert_before(neg_hi);
i.insert_before(assign(neg_hi, add(bit_not(u2i(hi)),
- u2i(carry(bit_not(lo), c1)))));
+ u2i(_carry(bit_not(lo), c1)))));
ir->operation = ir_triop_csel;
ir->operands[0] = new(ir) ir_dereference_variable(different_signs);