[Mesa-dev] [RFC 3/5] amd/nir: Implement the new ordered/unordered comparisons
Jason Ekstrand
jason at jlekstrand.net
Thu Nov 22 18:46:46 UTC 2018
They map directly to LLVM opcodes so it's really easy.
---
src/amd/common/ac_nir_to_llvm.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index c82c2ab548d..97a553505bc 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -708,8 +708,8 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
case nir_op_feq:
result = emit_float_cmp(&ctx->ac, LLVMRealOEQ, src[0], src[1]);
break;
- case nir_op_fneu:
- result = emit_float_cmp(&ctx->ac, LLVMRealUNE, src[0], src[1]);
+ case nir_op_fne:
+ result = emit_float_cmp(&ctx->ac, LLVMRealONE, src[0], src[1]);
break;
case nir_op_flt:
result = emit_float_cmp(&ctx->ac, LLVMRealOLT, src[0], src[1]);
@@ -717,6 +717,18 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
case nir_op_fge:
result = emit_float_cmp(&ctx->ac, LLVMRealOGE, src[0], src[1]);
break;
+ case nir_op_fequ:
+ result = emit_float_cmp(&ctx->ac, LLVMRealUEQ, src[0], src[1]);
+ break;
+ case nir_op_fneu:
+ result = emit_float_cmp(&ctx->ac, LLVMRealUNE, src[0], src[1]);
+ break;
+ case nir_op_fltu:
+ result = emit_float_cmp(&ctx->ac, LLVMRealULT, src[0], src[1]);
+ break;
+ case nir_op_fgeu:
+ result = emit_float_cmp(&ctx->ac, LLVMRealUGE, src[0], src[1]);
+ break;
case nir_op_fabs:
result = emit_intrin_1f_param(&ctx->ac, "llvm.fabs",
ac_to_float_type(&ctx->ac, def_type), src[0]);
--
2.19.1
More information about the mesa-dev
mailing list