mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-10 16:28:27 +02:00
amd/llvm: fix LLVM asserts for integer constants
After LLVM APIint's refactor, integer signedness needs to be handled explicitly.
This commit is contained in:
parent
96afed314b
commit
2d0df2deeb
1 changed files with 10 additions and 4 deletions
|
|
@ -1192,7 +1192,7 @@ void ac_set_range_metadata(struct ac_llvm_context *ctx, LLVMValueRef value, unsi
|
|||
|
||||
LLVMValueRef ac_get_thread_id(struct ac_llvm_context *ctx)
|
||||
{
|
||||
return ac_build_mbcnt(ctx, LLVMConstInt(ctx->iN_wavemask, ~0ull, 0));
|
||||
return ac_build_mbcnt(ctx, LLVMConstAllOnes(ctx->iN_wavemask));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1822,7 +1822,7 @@ LLVMValueRef ac_build_cvt_pk_i16(struct ac_llvm_context *ctx, LLVMValueRef args[
|
|||
assert(bits == 8 || bits == 10 || bits == 16);
|
||||
|
||||
LLVMValueRef max_rgb = LLVMConstInt(ctx->i32, bits == 8 ? 127 : bits == 10 ? 511 : 32767, 0);
|
||||
LLVMValueRef min_rgb = LLVMConstInt(ctx->i32, bits == 8 ? -128 : bits == 10 ? -512 : -32768, 0);
|
||||
LLVMValueRef min_rgb = LLVMConstInt(ctx->i32, bits == 8 ? -128 : bits == 10 ? -512 : -32768, 1);
|
||||
LLVMValueRef max_alpha = bits != 10 ? max_rgb : ctx->i32_1;
|
||||
LLVMValueRef min_alpha = bits != 10 ? min_rgb : LLVMConstInt(ctx->i32, -2, 0);
|
||||
|
||||
|
|
@ -1997,8 +1997,14 @@ LLVMValueRef ac_build_fsat(struct ac_llvm_context *ctx, LLVMValueRef src,
|
|||
|
||||
LLVMValueRef ac_const_uint_vec(struct ac_llvm_context *ctx, LLVMTypeRef type, uint64_t value)
|
||||
{
|
||||
bool isVector = (LLVMGetTypeKind(type) == LLVMVectorTypeKind);
|
||||
LLVMTypeRef ty = (isVector ? LLVMGetElementType(type) : type);
|
||||
|
||||
if (LLVMGetTypeKind(type) == LLVMVectorTypeKind) {
|
||||
if (LLVMGetIntTypeWidth(ty) < 64) {
|
||||
value = value & ((1lu << LLVMGetIntTypeWidth(ty)) - 1);
|
||||
}
|
||||
|
||||
if (isVector) {
|
||||
LLVMValueRef scalar = LLVMConstInt(LLVMGetElementType(type), value, 0);
|
||||
unsigned vec_size = LLVMGetVectorSize(type);
|
||||
LLVMValueRef *scalars = alloca(vec_size * sizeof(LLVMValueRef));
|
||||
|
|
@ -2212,7 +2218,7 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx, LLVMTypeRef dst_type, LLVM
|
|||
/* TODO: We need an intrinsic to skip this conditional. */
|
||||
/* Check for zero: */
|
||||
return LLVMBuildSelect(ctx->builder, LLVMBuildICmp(ctx->builder, LLVMIntEQ, src0, zero, ""),
|
||||
LLVMConstInt(ctx->i32, -1, 0), lsb, "");
|
||||
LLVMConstInt(ctx->i32, -1, 1), lsb, "");
|
||||
}
|
||||
|
||||
static struct ac_llvm_flow *get_current_flow(struct ac_llvm_context *ctx)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue