summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-06-21 19:19:49 -0400
committerMarek Olšák <[email protected]>2018-06-25 18:33:58 -0400
commit7888245ef308ab97ada144d265efa5e4245ebc18 (patch)
treeb373ed123470fdfb5e56d267d3b97ab07cba1889
parent0810f15046f3bcbcb8c9c9895e2b676b97720df1 (diff)
radeonsi: stop using lp_build_emit_llvm_unary/binary
Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c17
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c17
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c7
3 files changed, 18 insertions, 23 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 9bc679f3296..b04ad217ce3 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2141,9 +2141,8 @@ void si_load_system_value(struct si_shader_context *ctx,
LLVMGetParam(ctx->main_fn, SI_PARAM_POS_X_FLOAT),
LLVMGetParam(ctx->main_fn, SI_PARAM_POS_Y_FLOAT),
LLVMGetParam(ctx->main_fn, SI_PARAM_POS_Z_FLOAT),
- lp_build_emit_llvm_unary(&ctx->bld_base, TGSI_OPCODE_RCP,
- LLVMGetParam(ctx->main_fn,
- SI_PARAM_POS_W_FLOAT)),
+ ac_build_fdiv(&ctx->ac, ctx->ac.f32_1,
+ LLVMGetParam(ctx->main_fn, SI_PARAM_POS_W_FLOAT)),
};
value = ac_build_gather_values(&ctx->ac, pos, 4);
break;
@@ -2164,10 +2163,8 @@ void si_load_system_value(struct si_shader_context *ctx,
LLVMConstReal(ctx->f32, 0),
LLVMConstReal(ctx->f32, 0)
};
- pos[0] = lp_build_emit_llvm_unary(&ctx->bld_base,
- TGSI_OPCODE_FRC, pos[0]);
- pos[1] = lp_build_emit_llvm_unary(&ctx->bld_base,
- TGSI_OPCODE_FRC, pos[1]);
+ pos[0] = ac_build_fract(&ctx->ac, pos[0], 32);
+ pos[1] = ac_build_fract(&ctx->ac, pos[1], 32);
value = ac_build_gather_values(&ctx->ac, pos, 4);
break;
}
@@ -4021,8 +4018,10 @@ static LLVMValueRef si_llvm_emit_ddxy_interp(
for (i = 0; i < 2; i++) {
a = LLVMBuildExtractElement(ctx->ac.builder, interp_ij,
LLVMConstInt(ctx->i32, i, 0), "");
- result[i] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_DDX, a);
- result[2+i] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_DDY, a);
+ result[i] = ac_build_ddxy(&ctx->ac, AC_TID_MASK_TOP_LEFT, 1,
+ ac_to_integer(&ctx->ac, a)); /* DDX */
+ result[2+i] = ac_build_ddxy(&ctx->ac, AC_TID_MASK_TOP_LEFT, 2,
+ ac_to_integer(&ctx->ac, a)); /* DDY */
}
return ac_build_gather_values(&ctx->ac, result, 4);
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index 3008c3ade14..43922dc33ca 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -244,7 +244,9 @@ static void emit_arl(const struct lp_build_tgsi_action *action,
struct lp_build_emit_data *emit_data)
{
struct si_shader_context *ctx = si_shader_context(bld_base);
- LLVMValueRef floor_index = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_FLR, emit_data->args[0]);
+ LLVMValueRef floor_index =
+ ac_build_intrinsic(&ctx->ac, "llvm.floor.f32", ctx->f32,
+ &emit_data->args[0], 1, AC_FUNC_ATTR_READNONE);
emit_data->output[emit_data->chan] = LLVMBuildFPToSI(ctx->ac.builder,
floor_index, ctx->i32, "");
}
@@ -556,10 +558,8 @@ static void emit_iabs(const struct lp_build_tgsi_action *action,
struct si_shader_context *ctx = si_shader_context(bld_base);
emit_data->output[emit_data->chan] =
- lp_build_emit_llvm_binary(bld_base, TGSI_OPCODE_IMAX,
- emit_data->args[0],
- LLVMBuildNeg(ctx->ac.builder,
- emit_data->args[0], ""));
+ ac_build_imax(&ctx->ac, emit_data->args[0],
+ LLVMBuildNeg(ctx->ac.builder, emit_data->args[0], ""));
}
static void emit_minmax_int(const struct lp_build_tgsi_action *action,
@@ -668,12 +668,11 @@ static void emit_rsq(const struct lp_build_tgsi_action *action,
struct si_shader_context *ctx = si_shader_context(bld_base);
LLVMValueRef sqrt =
- lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_SQRT,
- emit_data->args[0]);
+ ac_build_intrinsic(&ctx->ac, "llvm.sqrt.f32", ctx->f32,
+ &emit_data->args[0], 1, AC_FUNC_ATTR_READNONE);
emit_data->output[emit_data->chan] =
- lp_build_emit_llvm_binary(bld_base, TGSI_OPCODE_DIV,
- ctx->ac.f32_1, sqrt);
+ ac_build_fdiv(&ctx->ac, ctx->ac.f32_1, sqrt);
}
static void dfracexp_fetch_args(struct lp_build_tgsi_context *bld_base,
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index c91bcc56971..427fead09d0 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -1286,8 +1286,7 @@ static void tex_fetch_args(
emit_data->inst, 0,
chan);
if (opcode == TGSI_OPCODE_TXP)
- args.coords[chan] = lp_build_emit_llvm_binary(
- bld_base, TGSI_OPCODE_DIV,
+ args.coords[chan] = ac_build_fdiv(&ctx->ac,
args.coords[chan], args.coords[3]);
}
@@ -1640,9 +1639,7 @@ si_lower_gather4_integer(struct si_shader_context *ctx,
LLVMBuildExtractElement(builder, txq_emit_data.output[0],
LLVMConstInt(ctx->i32, c, 0), "");
half_texel[c] = LLVMBuildUIToFP(builder, half_texel[c], ctx->f32, "");
- half_texel[c] =
- lp_build_emit_llvm_unary(&ctx->bld_base,
- TGSI_OPCODE_RCP, half_texel[c]);
+ half_texel[c] = ac_build_fdiv(&ctx->ac, ctx->ac.f32_1, half_texel[c]);
half_texel[c] = LLVMBuildFMul(builder, half_texel[c],
LLVMConstReal(ctx->f32, -0.5), "");
}