mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
intel: Implement abs, neg, and sat in the back-end
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
parent
4fde459563
commit
8ffbb54405
2 changed files with 44 additions and 9 deletions
|
|
@ -1112,6 +1112,28 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
|
||||||
inst->saturate = instr->dest.saturate;
|
inst->saturate = instr->dest.saturate;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case nir_op_fsat:
|
||||||
|
inst = bld.MOV(result, op[0]);
|
||||||
|
inst->saturate = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nir_op_fneg:
|
||||||
|
case nir_op_ineg:
|
||||||
|
op[0].negate = true;
|
||||||
|
inst = bld.MOV(result, op[0]);
|
||||||
|
if (instr->op == nir_op_fneg)
|
||||||
|
inst->saturate = instr->dest.saturate;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nir_op_fabs:
|
||||||
|
case nir_op_iabs:
|
||||||
|
op[0].negate = false;
|
||||||
|
op[0].abs = true;
|
||||||
|
inst = bld.MOV(result, op[0]);
|
||||||
|
if (instr->op == nir_op_fabs)
|
||||||
|
inst->saturate = instr->dest.saturate;
|
||||||
|
break;
|
||||||
|
|
||||||
case nir_op_fsign:
|
case nir_op_fsign:
|
||||||
emit_fsign(bld, instr, result, op, 0);
|
emit_fsign(bld, instr, result, op, 0);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1123,6 +1123,28 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
|
||||||
emit_conversion_to_double(dst, op[0], instr->dest.saturate);
|
emit_conversion_to_double(dst, op[0], instr->dest.saturate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case nir_op_fsat:
|
||||||
|
inst = emit(MOV(dst, op[0]));
|
||||||
|
inst->saturate = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nir_op_fneg:
|
||||||
|
case nir_op_ineg:
|
||||||
|
op[0].negate = true;
|
||||||
|
inst = emit(MOV(dst, op[0]));
|
||||||
|
if (instr->op == nir_op_fneg)
|
||||||
|
inst->saturate = instr->dest.saturate;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nir_op_fabs:
|
||||||
|
case nir_op_iabs:
|
||||||
|
op[0].negate = false;
|
||||||
|
op[0].abs = true;
|
||||||
|
inst = emit(MOV(dst, op[0]));
|
||||||
|
if (instr->op == nir_op_fabs)
|
||||||
|
inst->saturate = instr->dest.saturate;
|
||||||
|
break;
|
||||||
|
|
||||||
case nir_op_iadd:
|
case nir_op_iadd:
|
||||||
assert(nir_dest_bit_size(instr->dest.dest) < 64);
|
assert(nir_dest_bit_size(instr->dest.dest) < 64);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
@ -1889,15 +1911,6 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
|
||||||
inst->saturate = instr->dest.saturate;
|
inst->saturate = instr->dest.saturate;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_op_iabs:
|
|
||||||
case nir_op_ineg:
|
|
||||||
assert(nir_dest_bit_size(instr->dest.dest) < 64);
|
|
||||||
/* fall through */
|
|
||||||
case nir_op_fabs:
|
|
||||||
case nir_op_fneg:
|
|
||||||
case nir_op_fsat:
|
|
||||||
unreachable("not reached: should be lowered by lower_source mods");
|
|
||||||
|
|
||||||
case nir_op_fdiv:
|
case nir_op_fdiv:
|
||||||
unreachable("not reached: should be lowered by DIV_TO_MUL_RCP in the compiler");
|
unreachable("not reached: should be lowered by DIV_TO_MUL_RCP in the compiler");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue