ac/nir: implement half-float nir_op_frcp
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 6 Dec 2018 14:33:21 +0000 (14:33 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Tue, 19 Feb 2019 11:04:35 +0000 (11:04 +0000)
v2: don't use ac_get_onef()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_nir_to_llvm.c

index 336346f60401bde1238d2a6b571167892fd9ae5e..8a4346ebc140f2c5bc5972b9fb1d576c3aa8db35 100644 (file)
@@ -657,8 +657,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                break;
        case nir_op_frcp:
                src[0] = ac_to_float(&ctx->ac, src[0]);
-               result = ac_build_fdiv(&ctx->ac, instr->dest.dest.ssa.bit_size == 32 ? ctx->ac.f32_1 : ctx->ac.f64_1,
-                                      src[0]);
+               result = ac_build_fdiv(&ctx->ac, LLVMConstReal(LLVMTypeOf(src[0]), 1.0), src[0]);
                break;
        case nir_op_iand:
                result = LLVMBuildAnd(ctx->ac.builder, src[0], src[1], "");