From b24cfd0d4079cf1daaeb97f29c27947d786dc8eb Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Fri, 28 Jan 2022 15:11:42 -0800 Subject: [PATCH] microsoft/compiler: Handle b2f64 Reviewed-by: Bill Kristiansen Reviewed-By: Sil Vilerino Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 98779a2..c0c1bf2 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -2112,6 +2112,23 @@ emit_b2f32(struct ntd_context *ctx, nir_alu_instr *alu, const struct dxil_value } static bool +emit_b2f64(struct ntd_context *ctx, nir_alu_instr *alu, const struct dxil_value *val) +{ + assert(val); + + struct dxil_module *m = &ctx->mod; + + const struct dxil_value *c1 = dxil_module_get_double_const(m, 1.0); + const struct dxil_value *c0 = dxil_module_get_double_const(m, 0.0); + + if (!c0 || !c1) + return false; + + ctx->mod.feats.doubles = 1; + return emit_select(ctx, alu, val, c1, c0); +} + +static bool emit_f2b32(struct ntd_context *ctx, nir_alu_instr *alu, const struct dxil_value *val) { assert(val); @@ -2431,6 +2448,7 @@ emit_alu(struct ntd_context *ctx, nir_alu_instr *alu) case nir_op_f2b32: return emit_f2b32(ctx, alu, src[0]); case nir_op_b2f16: return emit_b2f16(ctx, alu, src[0]); case nir_op_b2f32: return emit_b2f32(ctx, alu, src[0]); + case nir_op_b2f64: return emit_b2f64(ctx, alu, src[0]); default: NIR_INSTR_UNSUPPORTED(&alu->instr); assert("Unimplemented ALU instruction"); -- 2.7.4