[Mesa-dev] [PATCH 2/2] radv/ac: emit isinf using ordered equal (v2)

Dave Airlie airlied at gmail.com
Fri Mar 17 02:27:41 UTC 2017


From: Dave Airlie <airlied at redhat.com>

This fixes:
dEQP-VK.glsl.builtin.function.common.isinf.*

v2: update to lower_isinf.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/common/ac_nir_to_llvm.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 9a6b952..77e3a85 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1181,6 +1181,17 @@ static LLVMValueRef emit_ddxy(struct nir_to_llvm_context *ctx,
 	return result;
 }
 
+static LLVMValueRef emit_isinf(struct nir_to_llvm_context *ctx,
+			       nir_alu_instr *instr,
+			       LLVMValueRef src0)
+{
+	LLVMTypeRef def_type = get_def_type(ctx, &instr->dest.dest.ssa);
+	src0 = emit_intrin_1f_param(ctx, "llvm.fabs",
+				   to_float_type(ctx, def_type), src0);
+	src0 = emit_float_cmp(ctx, LLVMRealOEQ, src0, LLVMConstReal(ctx->f32, INFINITY));
+	return src0;
+}
+
 /*
  * this takes an I,J coordinate pair,
  * and works out the X and Y derivatives.
@@ -1544,6 +1555,9 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
 	case nir_op_fddy_coarse:
 		result = emit_ddxy(ctx, instr->op, src[0]);
 		break;
+	case nir_op_isinf:
+		result = emit_isinf(ctx, instr, src[0]);
+		break;
 	default:
 		fprintf(stderr, "Unknown NIR alu instr: ");
 		nir_print_instr(&instr->instr, stderr);
-- 
2.9.3



More information about the mesa-dev mailing list