aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Lejeune <[email protected]>2012-11-29 23:43:05 +0100
committerVincent Lejeune <[email protected]>2012-12-05 18:30:39 +0100
commit0a2f58f6ed3f4db98c1826e5e5be3159815042f6 (patch)
tree079915fe4fedd1d88a33d82477bfcd9667106277 /src
parent0ad1fefd6951aa47ab58a41dc9ee73083cbcf85c (diff)
gallivm: have a default emit function for fdiv/rcp
Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
index 17f288f964e..cd57faef0c0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
@@ -584,6 +584,29 @@ mul_emit(
emit_data->args[0], emit_data->args[1]);
}
+/*.TGSI_OPCODE_DIV.*/
+static void fdiv_emit(
+ const struct lp_build_tgsi_action * action,
+ struct lp_build_tgsi_context * bld_base,
+ struct lp_build_emit_data * emit_data)
+{
+ emit_data->output[emit_data->chan] = LLVMBuildFDiv(
+ bld_base->base.gallivm->builder,
+ emit_data->args[0], emit_data->args[1], "");
+}
+
+/*.TGSI_OPCODE_RCP.*/
+static void rcp_emit(
+ const struct lp_build_tgsi_action * action,
+ struct lp_build_tgsi_context * bld_base,
+ struct lp_build_emit_data * emit_data)
+{
+ LLVMValueRef one;
+ one = lp_build_const_float(bld_base->base.gallivm, 1.0f);
+ emit_data->output[emit_data->chan] = lp_build_emit_llvm_binary(bld_base,
+ TGSI_OPCODE_DIV, one, emit_data->args[0]);
+}
+
/* TGSI_OPCODE_POW */
static void
@@ -811,6 +834,8 @@ lp_set_default_actions(struct lp_build_tgsi_context * bld_base)
bld_base->op_actions[TGSI_OPCODE_MAD].emit = mad_emit;
bld_base->op_actions[TGSI_OPCODE_MOV].emit = mov_emit;
bld_base->op_actions[TGSI_OPCODE_MUL].emit = mul_emit;
+ bld_base->op_actions[TGSI_OPCODE_DIV].emit = fdiv_emit;
+ bld_base->op_actions[TGSI_OPCODE_RCP].emit = rcp_emit;
bld_base->op_actions[TGSI_OPCODE_SFL].emit = sfl_emit;
bld_base->op_actions[TGSI_OPCODE_STR].emit = str_emit;
bld_base->op_actions[TGSI_OPCODE_SUB].emit = sub_emit;