nir/spirv: Implement IsInf and IsNan built-ins.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 30 Dec 2015 00:21:09 +0000 (16:21 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 30 Dec 2015 22:10:44 +0000 (14:10 -0800)
src/glsl/nir/spirv/spirv_to_nir.c

index b6e38704887da2d105bd2c1b7b3c1589e3b5c2b2..b6f5dd761bb36a1ed38b8f0317754baaff11d14b 100644 (file)
@@ -2706,7 +2706,14 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
       unreachable("No NIR equivalent");
 
    case SpvOpIsNan:
+      val->ssa->def = nir_fne(&b->nb, src[0], src[0]);
+      return;
+
    case SpvOpIsInf:
+      val->ssa->def = nir_feq(&b->nb, nir_fabs(&b->nb, src[0]),
+                                      nir_imm_float(&b->nb, INFINITY));
+      return;
+
    case SpvOpIsFinite:
    case SpvOpIsNormal:
    case SpvOpSignBitSet: