v2: Drop frexp. Rebase on builtins rewrite.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
B1(findLSB)
B1(findMSB)
B1(fma)
+ B2(ldexp)
#undef B0
#undef B1
#undef B2
IU(findLSB)
IU(findMSB)
F(fma)
+
+ add_function("ldexp",
+ _ldexp(glsl_type::float_type, glsl_type::int_type),
+ _ldexp(glsl_type::vec2_type, glsl_type::ivec2_type),
+ _ldexp(glsl_type::vec3_type, glsl_type::ivec3_type),
+ _ldexp(glsl_type::vec4_type, glsl_type::ivec4_type),
+ NULL);
#undef F
#undef FI
#undef FIU
return sig;
}
+
+ir_function_signature *
+builtin_builder::_ldexp(const glsl_type *x_type, const glsl_type *exp_type)
+{
+ return binop(ir_binop_ldexp, gpu_shader5, x_type, x_type, exp_type);
+}
/** @} */
/******************************************************************************/
case ir_binop_lshift:
case ir_binop_rshift:
case ir_binop_bfm:
+ case ir_binop_ldexp:
this->type = op0->type;
break;
"packHalf2x16_split",
"bfm",
"ubo_load",
+ "ldexp",
"vector_extract",
"fma",
"lrp",
*/
ir_binop_ubo_load,
+ /**
+ * \name Multiplies a number by two to a power, part of ARB_gpu_shader5.
+ */
+ /*@{*/
+ ir_binop_ldexp,
+ /*@}*/
+
/**
* Extract a scalar from a vector
*
switch (this->operation) {
case ir_binop_lshift:
case ir_binop_rshift:
+ case ir_binop_ldexp:
case ir_binop_vector_extract:
case ir_triop_csel:
case ir_triop_bitfield_extract:
break;
}
+ case ir_binop_ldexp:
+ for (unsigned c = 0; c < components; c++) {
+ data.f[c] = ldexp(op[0]->value.f[c], op[1]->value.i[c]);
+ /* Flush subnormal values to zero. */
+ if (!isnormal(data.f[c]))
+ data.f[c] = copysign(0.0, op[0]->value.f[c]);
+ }
+ break;
+
case ir_triop_fma:
assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
assert(op[1]->type->base_type == GLSL_TYPE_FLOAT);
assert(ir->operands[1]->type == glsl_type::uint_type);
break;
+ case ir_binop_ldexp:
+ assert(ir->operands[0]->type == ir->type);
+ assert(ir->operands[0]->type->is_float());
+ assert(ir->operands[1]->type->base_type == GLSL_TYPE_INT);
+ assert(ir->operands[0]->type->components() ==
+ ir->operands[1]->type->components());
+ break;
+
case ir_binop_vector_extract:
assert(ir->operands[0]->type->is_vector());
assert(ir->operands[1]->type->is_scalar()
case ir_unop_unpack_unorm_2x16:
case ir_unop_unpack_unorm_4x8:
case ir_unop_unpack_half_2x16:
+ case ir_binop_ldexp:
case ir_binop_vector_extract:
case ir_triop_vector_insert:
case ir_quadop_bitfield_insert:
assert(!"not reached: should be handled by lower_vector_insert()");
break;
+ case ir_binop_ldexp:
+ assert(!"not reached: should be handled by ldexp_to_arith()");
+ break;
+
case ir_unop_sqrt:
emit_math(SHADER_OPCODE_SQRT, this->result, op[0]);
break;
case ir_binop_pack_half_2x16_split:
assert(!"not reached: should not occur in vertex shader");
break;
+ case ir_binop_ldexp:
+ assert(!"not reached: should be handled by ldexp_to_arith()");
+ break;
}
}
case ir_triop_bitfield_extract:
case ir_triop_vector_insert:
case ir_quadop_bitfield_insert:
+ case ir_binop_ldexp:
case ir_triop_csel:
assert(!"not supported");
break;
case ir_quadop_vector:
case ir_binop_vector_extract:
case ir_triop_vector_insert:
+ case ir_binop_ldexp:
case ir_triop_csel:
/* This operation is not supported, or should have already been handled.
*/