mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 01:18:06 +02:00
fix(gallivm): Replace LLVMConstF* with LLVMBuild* methods.
LLVM 15 removed support for LLVMConstF in commit 4bb7b6fae3be02031878b2aa3be584c6627ad8ec. Reference:4bb7b6fae3Reference:07146a9e64/llvm/docs/ReleaseNotes.rst (changes-to-the-c-api)Closes: mesa/mesa#6863 Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org> Reviewed-by: Mihai Preda <mhpreda@gmail.com> Tested-by: Marcus Seyfarth <m.seyfarth@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17518>
This commit is contained in:
parent
a41e8dc588
commit
301bcbac0e
1 changed files with 18 additions and 59 deletions
|
|
@ -391,16 +391,10 @@ lp_build_comp(struct lp_build_context *bld,
|
|||
return LLVMBuildNot(builder, a, "");
|
||||
}
|
||||
|
||||
if (LLVMIsConstant(a))
|
||||
if (type.floating)
|
||||
return LLVMConstFSub(bld->one, a);
|
||||
else
|
||||
return LLVMConstSub(bld->one, a);
|
||||
if (type.floating)
|
||||
return LLVMBuildFSub(builder, bld->one, a, "");
|
||||
else
|
||||
if (type.floating)
|
||||
return LLVMBuildFSub(builder, bld->one, a, "");
|
||||
else
|
||||
return LLVMBuildSub(builder, bld->one, a, "");
|
||||
return LLVMBuildSub(builder, bld->one, a, "");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -485,16 +479,10 @@ lp_build_add(struct lp_build_context *bld,
|
|||
}
|
||||
}
|
||||
|
||||
if (LLVMIsConstant(a) && LLVMIsConstant(b))
|
||||
if (type.floating)
|
||||
res = LLVMConstFAdd(a, b);
|
||||
else
|
||||
res = LLVMConstAdd(a, b);
|
||||
if (type.floating)
|
||||
res = LLVMBuildFAdd(builder, a, b, "");
|
||||
else
|
||||
if (type.floating)
|
||||
res = LLVMBuildFAdd(builder, a, b, "");
|
||||
else
|
||||
res = LLVMBuildAdd(builder, a, b, "");
|
||||
res = LLVMBuildAdd(builder, a, b, "");
|
||||
|
||||
/* clamp to ceiling of 1.0 */
|
||||
if (bld->type.norm && (bld->type.floating || bld->type.fixed))
|
||||
|
|
@ -832,16 +820,10 @@ lp_build_sub(struct lp_build_context *bld,
|
|||
}
|
||||
}
|
||||
|
||||
if (LLVMIsConstant(a) && LLVMIsConstant(b))
|
||||
if (type.floating)
|
||||
res = LLVMConstFSub(a, b);
|
||||
else
|
||||
res = LLVMConstSub(a, b);
|
||||
if (type.floating)
|
||||
res = LLVMBuildFSub(builder, a, b, "");
|
||||
else
|
||||
if (type.floating)
|
||||
res = LLVMBuildFSub(builder, a, b, "");
|
||||
else
|
||||
res = LLVMBuildSub(builder, a, b, "");
|
||||
res = LLVMBuildSub(builder, a, b, "");
|
||||
|
||||
if (bld->type.norm && (bld->type.floating || bld->type.fixed))
|
||||
res = lp_build_max_simple(bld, res, bld->zero, GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN);
|
||||
|
|
@ -995,29 +977,15 @@ lp_build_mul(struct lp_build_context *bld,
|
|||
? lp_build_const_int_vec(bld->gallivm, type, type.width/2) : NULL;
|
||||
|
||||
LLVMValueRef res;
|
||||
if (LLVMIsConstant(a) && LLVMIsConstant(b)) {
|
||||
if (type.floating)
|
||||
res = LLVMConstFMul(a, b);
|
||||
if (type.floating)
|
||||
res = LLVMBuildFMul(builder, a, b, "");
|
||||
else
|
||||
res = LLVMBuildMul(builder, a, b, "");
|
||||
if (shift) {
|
||||
if (type.sign)
|
||||
res = LLVMBuildAShr(builder, res, shift, "");
|
||||
else
|
||||
res = LLVMConstMul(a, b);
|
||||
if (shift) {
|
||||
if (type.sign)
|
||||
res = LLVMConstAShr(res, shift);
|
||||
else
|
||||
res = LLVMConstLShr(res, shift);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (type.floating)
|
||||
res = LLVMBuildFMul(builder, a, b, "");
|
||||
else
|
||||
res = LLVMBuildMul(builder, a, b, "");
|
||||
if (shift) {
|
||||
if (type.sign)
|
||||
res = LLVMBuildAShr(builder, res, shift, "");
|
||||
else
|
||||
res = LLVMBuildLShr(builder, res, shift, "");
|
||||
}
|
||||
res = LLVMBuildLShr(builder, res, shift, "");
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -1304,15 +1272,6 @@ lp_build_div(struct lp_build_context *bld,
|
|||
if (a == bld->undef || b == bld->undef)
|
||||
return bld->undef;
|
||||
|
||||
if (LLVMIsConstant(a) && LLVMIsConstant(b)) {
|
||||
if (type.floating)
|
||||
return LLVMConstFDiv(a, b);
|
||||
else if (type.sign)
|
||||
return LLVMConstSDiv(a, b);
|
||||
else
|
||||
return LLVMConstUDiv(a, b);
|
||||
}
|
||||
|
||||
/* fast rcp is disabled (just uses div), so makes no sense to try that */
|
||||
if (FALSE &&
|
||||
((util_get_cpu_caps()->has_sse && type.width == 32 && type.length == 4) ||
|
||||
|
|
@ -2670,7 +2629,7 @@ lp_build_rcp(struct lp_build_context *bld,
|
|||
assert(type.floating);
|
||||
|
||||
if (LLVMIsConstant(a))
|
||||
return LLVMConstFDiv(bld->one, a);
|
||||
return LLVMBuildFDiv(builder, bld->one, a, "");
|
||||
|
||||
/*
|
||||
* We don't use RCPPS because:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue