microsoft/compiler: Handle b2f64
authorJesse Natalie <jenatali@microsoft.com>
Fri, 28 Jan 2022 23:11:42 +0000 (15:11 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Feb 2022 00:07:53 +0000 (00:07 +0000)
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-By: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14837>

src/microsoft/compiler/nir_to_dxil.c

index 98779a2..c0c1bf2 100644 (file)
@@ -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");