spirv: Add a 64-bit implementation of OpIsInf
authorNeil Roberts <nroberts@igalia.com>
Wed, 21 Mar 2018 19:34:39 +0000 (20:34 +0100)
committerNeil Roberts <nroberts@igalia.com>
Tue, 17 Apr 2018 18:58:06 +0000 (20:58 +0200)
The only change neccessary is to change the type of the constant used
to compare against.

This has been tested against the arb_gpu_shader_fp64/execution/
fs-isinf-dvec tests using the ARB_gl_spirv branch.

v2: Use nir_imm_floatN_t for the constant.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/vtn_alu.c

index fc378495b8127aa11437594458ebf27db89325b1..71e743cdd1e7b6f629b84a2a932c056b5e0df2ee 100644 (file)
@@ -564,10 +564,11 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
       val->ssa->def = nir_fne(&b->nb, src[0], src[0]);
       break;
 
-   case SpvOpIsInf:
-      val->ssa->def = nir_ieq(&b->nb, nir_fabs(&b->nb, src[0]),
-                                      nir_imm_float(&b->nb, INFINITY));
+   case SpvOpIsInf: {
+      nir_ssa_def *inf = nir_imm_floatN_t(&b->nb, INFINITY, src[0]->bit_size);
+      val->ssa->def = nir_ieq(&b->nb, nir_fabs(&b->nb, src[0]), inf);
       break;
+   }
 
    case SpvOpFUnordEqual:
    case SpvOpFUnordNotEqual: