ir_rvalue *nonmul = ir->operands[1];
ir_expression *mul = ir->operands[0]->as_expression();
- bool mul_negate = false;
- if (mul && mul->operation == ir_unop_neg) {
+ bool mul_negate = false, mul_abs = false;
+ if (mul && mul->operation == ir_unop_abs) {
+ mul = mul->operands[0]->as_expression();
+ mul_abs = true;
+ } else if (mul && mul->operation == ir_unop_neg) {
mul = mul->operands[0]->as_expression();
mul_negate = true;
}
nonmul = ir->operands[0];
mul = ir->operands[1]->as_expression();
- if (mul && mul->operation == ir_unop_neg) {
+ if (mul && mul->operation == ir_unop_abs) {
+ mul = mul->operands[0]->as_expression();
+ mul_abs = true;
+ } else if (mul && mul->operation == ir_unop_neg) {
mul = mul->operands[0]->as_expression();
mul_negate = true;
}
mul->operands[0]->accept(this);
src_reg src1 = fix_3src_operand(this->result);
src1.negate ^= mul_negate;
+ src1.abs = mul_abs;
+ if (mul_abs)
+ src1.negate = false;
mul->operands[1]->accept(this);
src_reg src2 = fix_3src_operand(this->result);
+ src2.abs = mul_abs;
+ if (mul_abs)
+ src2.negate = false;
this->result = src_reg(this, ir->type);
emit(BRW_OPCODE_MAD, dst_reg(this->result), src0, src1, src2);