ac/nir: make use of ac_build_umin() where possible
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 10 Apr 2019 15:16:48 +0000 (17:16 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 12 Apr 2019 15:30:54 +0000 (17:30 +0200)
This changes the predicate from LessThan to Equal.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c

index f074a12c31bc9d4e4d11a7b070ef4ba3a582ffac..5995e001330ab370d36371d866be84d856731fd8 100644 (file)
@@ -757,7 +757,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                result = emit_minmax_int(&ctx->ac, LLVMIntUGT, src[0], src[1]);
                break;
        case nir_op_umin:
-               result = emit_minmax_int(&ctx->ac, LLVMIntULT, src[0], src[1]);
+               result = ac_build_umin(&ctx->ac, src[0], src[1]);
                break;
        case nir_op_isign:
                result = ac_build_isign(&ctx->ac, src[0],
@@ -1105,8 +1105,8 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                                                ac_to_float_type(&ctx->ac, def_type), result, src[2]);
                break;
        case nir_op_umin3:
-               result = emit_minmax_int(&ctx->ac, LLVMIntULT, src[0], src[1]);
-               result = emit_minmax_int(&ctx->ac, LLVMIntULT, result, src[2]);
+               result = ac_build_umin(&ctx->ac, src[0], src[1]);
+               result = ac_build_umin(&ctx->ac, result, src[2]);
                break;
        case nir_op_imin3:
                result = ac_build_imin(&ctx->ac, src[0], src[1]);
@@ -1142,9 +1142,9 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                break;
        }
        case nir_op_umed3: {
-               LLVMValueRef tmp1 = emit_minmax_int(&ctx->ac, LLVMIntULT, src[0], src[1]);
+               LLVMValueRef tmp1 = ac_build_umin(&ctx->ac, src[0], src[1]);
                LLVMValueRef tmp2 = emit_minmax_int(&ctx->ac, LLVMIntUGT, src[0], src[1]);
-               tmp2 = emit_minmax_int(&ctx->ac, LLVMIntULT, tmp2, src[2]);
+               tmp2 = ac_build_umin(&ctx->ac, tmp2, src[2]);
                result = emit_minmax_int(&ctx->ac, LLVMIntUGT, tmp1, tmp2);
                break;
        }