struct lp_build_tgsi_context * bld_base,
struct lp_build_emit_data * emit_data)
{
- emit_data->args[0] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS,
- emit_data->args[0]);
if (bld_base->rsq_action.emit) {
bld_base->rsq_action.emit(&bld_base->rsq_action, bld_base, emit_data);
} else {
}
/* Reciprical squareroot (CPU Only) */
-
-/* This is not the same as TGSI_OPCODE_RSQ, which requres the argument to be
- * greater than or equal to 0 */
static void
recip_sqrt_emit_cpu(
const struct lp_build_tgsi_action * action,
assert(src->f[2] != 0.0f);
assert(src->f[3] != 0.0f);
#endif
- dst->f[0] = 1.0f / sqrtf(fabsf(src->f[0]));
- dst->f[1] = 1.0f / sqrtf(fabsf(src->f[1]));
- dst->f[2] = 1.0f / sqrtf(fabsf(src->f[2]));
- dst->f[3] = 1.0f / sqrtf(fabsf(src->f[3]));
+ dst->f[0] = 1.0f / sqrtf(src->f[0]);
+ dst->f[1] = 1.0f / sqrtf(src->f[1]);
+ dst->f[2] = 1.0f / sqrtf(src->f[2]);
+ dst->f[3] = 1.0f / sqrtf(src->f[3]);
}
static void
micro_sqrt(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
- dst->f[0] = sqrtf(fabsf(src->f[0]));
- dst->f[1] = sqrtf(fabsf(src->f[1]));
- dst->f[2] = sqrtf(fabsf(src->f[2]));
- dst->f[3] = sqrtf(fabsf(src->f[3]));
+ dst->f[0] = sqrtf(src->f[0]);
+ dst->f[1] = sqrtf(src->f[1]);
+ dst->f[2] = sqrtf(src->f[2]);
+ dst->f[3] = sqrtf(src->f[3]);
}
static void
.. opcode:: RSQ - Reciprocal Square Root
-This instruction replicates its result.
+This instruction replicates its result. The results are undefined for src <= 0.
.. math::
- dst = \frac{1}{\sqrt{|src.x|}}
+ dst = \frac{1}{\sqrt{src.x}}
.. opcode:: SQRT - Square Root
-This instruction replicates its result.
+This instruction replicates its result. The results are undefined for src < 0.
.. math::
return TGSI_OPCODE_RCP;
case OPCODE_RET:
return TGSI_OPCODE_RET;
- case OPCODE_RSQ:
- return TGSI_OPCODE_RSQ;
case OPCODE_SCS:
return TGSI_OPCODE_SCS;
case OPCODE_SEQ:
emit_ddy( t, dst[0], &inst->SrcReg[0] );
break;
+ case OPCODE_RSQ:
+ ureg_RSQ( ureg, dst[0], ureg_abs(src[0]) );
+ break;
+
default:
ureg_insn( ureg,
translate_opcode( inst->Opcode ),