B2(frexp)
B1(uaddCarry)
B1(usubBorrow)
+ B1(mulExtended)
#undef B0
#undef B1
#undef B2
_usubBorrow(glsl_type::uvec3_type),
_usubBorrow(glsl_type::uvec4_type),
NULL);
+ add_function("imulExtended",
+ _mulExtended(glsl_type::int_type),
+ _mulExtended(glsl_type::ivec2_type),
+ _mulExtended(glsl_type::ivec3_type),
+ _mulExtended(glsl_type::ivec4_type),
+ NULL);
+ add_function("umulExtended",
+ _mulExtended(glsl_type::uint_type),
+ _mulExtended(glsl_type::uvec2_type),
+ _mulExtended(glsl_type::uvec3_type),
+ _mulExtended(glsl_type::uvec4_type),
+ NULL);
#undef F
#undef FI
#undef FIU
return sig;
}
+
+/**
+ * For both imulExtended() and umulExtended() built-ins.
+ */
+ir_function_signature *
+builtin_builder::_mulExtended(const glsl_type *type)
+{
+ ir_variable *x = in_var(type, "x");
+ ir_variable *y = in_var(type, "y");
+ ir_variable *msb = out_var(type, "msb");
+ ir_variable *lsb = out_var(type, "lsb");
+ MAKE_SIG(glsl_type::void_type, gpu_shader5, 4, x, y, msb, lsb);
+
+ body.emit(assign(msb, imul_high(x, y)));
+ body.emit(assign(lsb, mul(x, y)));
+
+ return sig;
+}
/** @} */
/******************************************************************************/
return expr(ir_binop_mul, a, b);
}
+ir_expression *imul_high(operand a, operand b)
+{
+ return expr(ir_binop_imul_high, a, b);
+}
+
ir_expression *div(operand a, operand b)
{
return expr(ir_binop_div, a, b);
ir_expression *add(operand a, operand b);
ir_expression *sub(operand a, operand b);
ir_expression *mul(operand a, operand b);
+ir_expression *imul_high(operand a, operand b);
ir_expression *div(operand a, operand b);
ir_expression *carry(operand a, operand b);
ir_expression *borrow(operand a, operand b);