v2: Add constant folding support.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
"bfm",
"ubo_load",
"vector_extract",
+ "fma",
"lrp",
"bfi",
"bitfield_extract",
*/
ir_last_binop = ir_binop_vector_extract,
+ /**
+ * \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
+ */
+ /*@{*/
+ ir_triop_fma,
+ /*@}*/
+
ir_triop_lrp,
/**
break;
}
+ case ir_triop_fma:
+ assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
+ assert(op[1]->type->base_type == GLSL_TYPE_FLOAT);
+ assert(op[2]->type->base_type == GLSL_TYPE_FLOAT);
+
+ for (unsigned c = 0; c < components; c++) {
+ data.f[c] = op[0]->value.f[c] * op[1]->value.f[c]
+ + op[2]->value.f[c];
+ }
+ break;
+
case ir_triop_lrp: {
assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
assert(op[1]->type->base_type == GLSL_TYPE_FLOAT);
&& ir->operands[1]->type->is_integer());
break;
+ case ir_triop_fma:
case ir_triop_lrp:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
assert(ir->operands[0]->type == ir->operands[1]->type);
case ir_binop_vector_extract:
case ir_binop_bfm:
+ case ir_triop_fma:
case ir_triop_bfi:
case ir_triop_bitfield_extract:
case ir_triop_vector_insert:
case ir_unop_find_msb:
case ir_unop_find_lsb:
case ir_binop_bfm:
+ case ir_triop_fma:
case ir_triop_bfi:
case ir_triop_bitfield_extract:
case ir_quadop_bitfield_insert: