aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Lejeune <[email protected]>2012-11-29 23:43:31 +0100
committerVincent Lejeune <[email protected]>2012-12-05 18:31:18 +0100
commit2d97f77b9f4ea58afe19f93dfc7ac7ed96819669 (patch)
treeddb90b938558ed548762c452945471c372bd630b /src
parent2a03f28e5489d6eb841e70dcf7521e3f275a0159 (diff)
gallivm: Have a default emit function for min/max opcode
Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c29
1 files changed, 29 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 cd57faef0c0..cc4bd2e1647 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
@@ -744,6 +744,32 @@ umul_emit(
emit_data->args[0], emit_data->args[1]);
}
+/* TGSI_OPCODE_MAX */
+static void fmax_emit(
+ const struct lp_build_tgsi_action * action,
+ struct lp_build_tgsi_context * bld_base,
+ struct lp_build_emit_data * emit_data)
+{
+ LLVMBuilderRef builder = bld_base->base.gallivm->builder;
+ emit_data->output[emit_data->chan] = LLVMBuildSelect(builder,
+ LLVMBuildFCmp(builder, LLVMRealUGE,
+ emit_data->args[0], emit_data->args[1], ""),
+ emit_data->args[0], emit_data->args[1], "");
+}
+
+/* TGSI_OPCODE_MIN */
+static void fmin_emit(
+ const struct lp_build_tgsi_action * action,
+ struct lp_build_tgsi_context * bld_base,
+ struct lp_build_emit_data * emit_data)
+{
+ LLVMBuilderRef builder = bld_base->base.gallivm->builder;
+ emit_data->output[emit_data->chan] = LLVMBuildSelect(builder,
+ LLVMBuildFCmp(builder, LLVMRealUGE,
+ emit_data->args[0], emit_data->args[1], ""),
+ emit_data->args[1], emit_data->args[0], "");
+}
+
/* TGSI_OPCODE_XPD */
static void
@@ -844,6 +870,9 @@ lp_set_default_actions(struct lp_build_tgsi_context * bld_base)
bld_base->op_actions[TGSI_OPCODE_U2F].emit = u2f_emit;
bld_base->op_actions[TGSI_OPCODE_UMAD].emit = umad_emit;
bld_base->op_actions[TGSI_OPCODE_UMUL].emit = umul_emit;
+
+ bld_base->op_actions[TGSI_OPCODE_MAX].emit = fmax_emit;
+ bld_base->op_actions[TGSI_OPCODE_MIN].emit = fmin_emit;
}
/* CPU Only default actions */