ac/llvm: fix bcsel for v2*16
authorMarek Olšák <marek.olsak@amd.com>
Sat, 4 Jul 2020 20:49:52 +0000 (16:49 -0400)
committerVivek Pandya <vivekvpandya@gmail.com>
Mon, 7 Sep 2020 15:55:16 +0000 (21:25 +0530)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

src/amd/llvm/ac_nir_to_llvm.c

index b8ecd2765fb7b97c88121b62a2b1b7293d4507aa..735c48884e6992c8e5550a880d9188c4b5571df6 100644 (file)
@@ -286,8 +286,6 @@ static LLVMValueRef emit_bcsel(struct ac_llvm_context *ctx,
        LLVMTypeRef src1_type = LLVMTypeOf(src1);
        LLVMTypeRef src2_type = LLVMTypeOf(src2);
 
-       assert(LLVMGetTypeKind(LLVMTypeOf(src0)) != LLVMVectorTypeKind);
-
        if (LLVMGetTypeKind(src1_type) == LLVMPointerTypeKind &&
            LLVMGetTypeKind(src2_type) != LLVMPointerTypeKind) {
                src2 = LLVMBuildIntToPtr(ctx->builder, src2, src1_type, "");
@@ -297,7 +295,7 @@ static LLVMValueRef emit_bcsel(struct ac_llvm_context *ctx,
        }
 
        LLVMValueRef v = LLVMBuildICmp(ctx->builder, LLVMIntNE, src0,
-                                      ctx->i32_0, "");
+                                      LLVMConstNull(LLVMTypeOf(src0)), "");
        return LLVMBuildSelect(ctx->builder, v,
                               ac_to_integer_or_pointer(ctx, src1),
                               ac_to_integer_or_pointer(ctx, src2), "");