nir: add support for d2f and f2d
authorConnor Abbott <connor.w.abbott@intel.com>
Thu, 30 Jul 2015 06:46:20 +0000 (23:46 -0700)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Mon, 11 Apr 2016 06:29:27 +0000 (08:29 +0200)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/glsl_to_nir.cpp
src/compiler/nir/nir_opcodes.py

index 0b83bdc4078e343964e943102616dd73ae457903..6a70c4d175851a674f5ecfc1cb8686a796f57a61 100644 (file)
@@ -1356,6 +1356,8 @@ nir_visitor::visit(ir_expression *ir)
    case ir_unop_f2b:  result = nir_f2b(&b, srcs[0]);   break;
    case ir_unop_i2b:  result = nir_i2b(&b, srcs[0]);   break;
    case ir_unop_b2i:  result = nir_b2i(&b, srcs[0]);   break;
+   case ir_unop_d2f:  result = nir_d2f(&b, srcs[0]);   break;
+   case ir_unop_f2d:  result = nir_f2d(&b, srcs[0]);   break;
    case ir_unop_i2u:
    case ir_unop_u2i:
    case ir_unop_bitcast_i2f:
index bc9845036d356c0061b95202cda875d239746d40..ef5442506527e8de3ed21c395fb5995e19cc48bb 100644 (file)
@@ -170,6 +170,9 @@ unop_convert("b2f", tfloat32, tbool, "src0 ? 1.0f : 0.0f")
 unop_convert("i2b", tbool, tint32, "src0 != 0")
 unop_convert("b2i", tint32, tbool, "src0 ? 1 : 0") # Boolean-to-int conversion
 unop_convert("u2f", tfloat32, tuint32, "src0") # Unsigned-to-float conversion.
+# double-to-float conversion
+unop_convert("d2f", tfloat32, tfloat64, "src0") # Single to double precision
+unop_convert("f2d", tfloat64, tfloat32, "src0") # Double to single precision
 
 # Unary floating-point rounding operations.