Merge branch 'llvm_target_setting_fix' into 'main'

amd/llvm: llvm-23 fixes

See merge request mesa/mesa!41822
This commit is contained in:
Ganesh Belgur Ramachandra 2026-05-31 12:36:51 +00:00
commit 6952994737
2 changed files with 11 additions and 5 deletions

View file

@ -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)

View file

@ -148,7 +148,7 @@ void ac_llvm_set_target_features(LLVMValueRef F, struct ac_llvm_context *ctx, bo
{
char features[2048];
snprintf(features, sizeof(features), "+DumpCode%s%s",
snprintf(features, sizeof(features), "+dumpcode%s%s",
/* Wave32 is the default. */
ctx->gfx_level >= GFX10 && ctx->wave_size == 64 ?
",+wavefrontsize64,-wavefrontsize32" : "",