ac/nir: implement half-float nir_op_ldexp
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 6 Dec 2018 14:36:56 +0000 (14:36 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Tue, 19 Feb 2019 11:04:46 +0000 (11:04 +0000)
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 a76687930d85f3a51b5f34d320454a0bd6936c3d..8fafe7639c648ca959a9996f7b7d30baed6cf651 100644 (file)
@@ -829,8 +829,10 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                break;
        case nir_op_ldexp:
                src[0] = ac_to_float(&ctx->ac, src[0]);
-               if (ac_get_elem_bits(&ctx->ac, LLVMTypeOf(src[0])) == 32)
+               if (ac_get_elem_bits(&ctx->ac, def_type) == 32)
                        result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.ldexp.f32", ctx->ac.f32, src, 2, AC_FUNC_ATTR_READNONE);
+               else if (ac_get_elem_bits(&ctx->ac, def_type) == 16)
+                       result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.ldexp.f16", ctx->ac.f16, src, 2, AC_FUNC_ATTR_READNONE);
                else
                        result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.ldexp.f64", ctx->ac.f64, src, 2, AC_FUNC_ATTR_READNONE);
                break;