vc4: Add support for nir_iabs.

Tested using the GLSL 1.30 tests for integer abs().  Not currently used,
but it was one of the new opcodes used by robclark's idiv lowering.
This commit is contained in:
Eric Anholt 2015-04-01 15:19:38 -07:00
parent e50cf5faa5
commit a9152376b4
1 changed files with 5 additions and 0 deletions

View File

@ -1069,9 +1069,14 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
case nir_op_fsign:
*dest = ntq_fsign(c, src[0]);
break;
case nir_op_fabs:
*dest = qir_FMAXABS(c, src[0], src[0]);
break;
case nir_op_iabs:
*dest = qir_MAX(c, src[0],
qir_SUB(c, qir_uniform_ui(c, 0), src[0]));
break;
default:
fprintf(stderr, "unknown NIR ALU inst: ");