From: Samuel Pitoiset Date: Wed, 13 Mar 2019 14:53:51 +0000 (+0100) Subject: ac: add various int8 definitions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e632eb24bbbf4142b092dd24d7b567bd974f2d2;p=mesa.git ac: add various int8 definitions Original patch by Rhys Perry. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 4d0cb555a42..195fdcb224d 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -87,6 +87,8 @@ ac_llvm_context_init(struct ac_llvm_context *ctx, ctx->v4f32 = LLVMVectorType(ctx->f32, 4); ctx->v8i32 = LLVMVectorType(ctx->i32, 8); + ctx->i8_0 = LLVMConstInt(ctx->i8, 0, false); + ctx->i8_1 = LLVMConstInt(ctx->i8, 1, false); ctx->i16_0 = LLVMConstInt(ctx->i16, 0, false); ctx->i16_1 = LLVMConstInt(ctx->i16, 1, false); ctx->i32_0 = LLVMConstInt(ctx->i32, 0, false); @@ -201,7 +203,9 @@ ac_get_type_size(LLVMTypeRef type) static LLVMTypeRef to_integer_type_scalar(struct ac_llvm_context *ctx, LLVMTypeRef t) { - if (t == ctx->f16 || t == ctx->i16) + if (t == ctx->i8) + return ctx->i8; + else if (t == ctx->f16 || t == ctx->i16) return ctx->i16; else if (t == ctx->f32 || t == ctx->i32) return ctx->i32; @@ -253,7 +257,9 @@ ac_to_integer_or_pointer(struct ac_llvm_context *ctx, LLVMValueRef v) static LLVMTypeRef to_float_type_scalar(struct ac_llvm_context *ctx, LLVMTypeRef t) { - if (t == ctx->i16 || t == ctx->f16) + if (t == ctx->i8) + return ctx->i8; + else if (t == ctx->i16 || t == ctx->f16) return ctx->f16; else if (t == ctx->i32 || t == ctx->f32) return ctx->f32; diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 723aec53cbe..f6bf473f6a1 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -74,6 +74,8 @@ struct ac_llvm_context { LLVMTypeRef v4f32; LLVMTypeRef v8i32; + LLVMValueRef i8_0; + LLVMValueRef i8_1; LLVMValueRef i16_0; LLVMValueRef i16_1; LLVMValueRef i32_0;